DawnC commited on
Commit
b4080d7
1 Parent(s): fbef23f

Update breed_recommendation.py

Browse files
Files changed (1) hide show
  1. breed_recommendation.py +14 -4
breed_recommendation.py CHANGED
@@ -163,18 +163,28 @@ def create_recommendation_tab(UserPreferences, get_breed_recommendations, format
163
  'has_children': args[7],
164
  'children_age': args[8] if args[7] else None,
165
  'noise_tolerance': args[9],
166
- 'search_type': 'Criteria' # 標記為條件搜索
167
  },
168
  results=history_results
169
  )
170
 
171
- return format_recommendation_html(recommendations, is_description_search=False)
172
-
 
 
 
 
 
 
 
 
 
173
  except Exception as e:
174
  print(f"Error in find match: {str(e)}")
175
  import traceback
176
  print(traceback.format_exc())
177
- return "Error getting recommendations"
 
178
 
179
  get_recommendations_btn.click(
180
  fn=on_find_match_click,
 
163
  'has_children': args[7],
164
  'children_age': args[8] if args[7] else None,
165
  'noise_tolerance': args[9],
166
+ 'search_type': 'Criteria'
167
  },
168
  results=history_results
169
  )
170
 
171
+ # return format_recommendation_html(recommendations, is_description_search=False)
172
+
173
+ # except Exception as e:
174
+ # print(f"Error in find match: {str(e)}")
175
+ # import traceback
176
+ # print(traceback.format_exc())
177
+ # return "Error getting recommendations"
178
+
179
+ html_result = format_recommendation_html(recommendations, is_description_search=False)
180
+ return gr.update(value=html_result, visible=True)
181
+
182
  except Exception as e:
183
  print(f"Error in find match: {str(e)}")
184
  import traceback
185
  print(traceback.format_exc())
186
+ return gr.update(value="Error getting recommendations", visible=True)
187
+
188
 
189
  get_recommendations_btn.click(
190
  fn=on_find_match_click,