Spaces:
Running
on
Zero
Running
on
Zero
Update breed_recommendation.py
Browse files- breed_recommendation.py +15 -15
breed_recommendation.py
CHANGED
@@ -398,9 +398,9 @@ def create_recommendation_tab(UserPreferences, get_breed_recommendations, format
|
|
398 |
# result = format_recommendation_html(final_recommendations, is_description_search=True)
|
399 |
# return [gr.update(value=result), gr.update(visible=False)]
|
400 |
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
|
405 |
|
406 |
def on_description_search(description: str):
|
@@ -581,18 +581,18 @@ def create_recommendation_tab(UserPreferences, get_breed_recommendations, format
|
|
581 |
'temperament': smart_rec.get('scores', {}).get('temperament', 0.0)
|
582 |
}
|
583 |
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
|
597 |
# 排序並更新排名
|
598 |
if final_recommendations:
|
|
|
398 |
# result = format_recommendation_html(final_recommendations, is_description_search=True)
|
399 |
# return [gr.update(value=result), gr.update(visible=False)]
|
400 |
|
401 |
+
# except Exception as e:
|
402 |
+
# error_msg = f"Error processing your description. Details: {str(e)}"
|
403 |
+
# return [gr.update(value=error_msg), gr.update(visible=False)]
|
404 |
|
405 |
|
406 |
def on_description_search(description: str):
|
|
|
581 |
'temperament': smart_rec.get('scores', {}).get('temperament', 0.0)
|
582 |
}
|
583 |
|
584 |
+
final_recommendations.append({
|
585 |
+
'rank': 0,
|
586 |
+
'breed': breed_name,
|
587 |
+
'scores': scores,
|
588 |
+
'base_score': round(base_score, 4),
|
589 |
+
'bonus_score': round(bonus_score, 4),
|
590 |
+
'final_score': round(final_score, 4),
|
591 |
+
'match_reason': ' • '.join(bonus_reasons) if bonus_reasons else "Standard match",
|
592 |
+
'info': breed_info,
|
593 |
+
'noise_info': breed_noise_info.get(breed_name, {}),
|
594 |
+
'health_info': breed_health_info.get(breed_name, {})
|
595 |
+
})
|
596 |
|
597 |
# 排序並更新排名
|
598 |
if final_recommendations:
|