DawnC commited on
Commit
e4ff382
1 Parent(s): 816322a

Update breed_recommendation.py

Browse files
Files changed (1) hide show
  1. breed_recommendation.py +17 -14
breed_recommendation.py CHANGED
@@ -13,9 +13,8 @@ from search_history import create_history_tab, create_history_component
13
  def create_custom_button_style():
14
  return """
15
  <style>
16
- /* 自定義按鈕樣式 */
17
  #find-match-btn {
18
- background: linear-gradient(90deg, #ff7e5f 0%, #feb47b 100%);
19
  border: none;
20
  border-radius: 30px;
21
  padding: 12px 24px;
@@ -24,14 +23,18 @@ def create_custom_button_style():
24
  cursor: pointer;
25
  transition: all 0.3s ease;
26
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
 
 
 
27
  }
28
-
29
  #find-match-btn:hover {
30
- box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
31
- opacity: 0.9;
 
 
 
 
32
  }
33
-
34
- /* 搜尋中提示樣式 */
35
  #search-status {
36
  text-align: center;
37
  padding: 10px;
@@ -274,12 +277,6 @@ def create_recommendation_tab(UserPreferences, get_breed_recommendations, format
274
  print(traceback.format_exc())
275
  return ["Error getting recommendations", gr.HTML.update(visible=False)]
276
 
277
- get_recommendations_btn.click(
278
- fn=lambda: gr.HTML.update(visible=True),
279
- outputs=search_status,
280
- queue=False # 確保立即執行
281
- )
282
-
283
  get_recommendations_btn.click(
284
  fn=on_find_match_click,
285
  inputs=[
@@ -295,7 +292,13 @@ def create_recommendation_tab(UserPreferences, get_breed_recommendations, format
295
  children_age,
296
  noise_tolerance
297
  ],
298
- outputs=[recommendation_output, search_status]
 
 
 
 
 
 
299
  )
300
 
301
  return {
 
13
  def create_custom_button_style():
14
  return """
15
  <style>
 
16
  #find-match-btn {
17
+ background: linear-gradient(90deg, #ff5f6d 0%, #ffc371 100%);
18
  border: none;
19
  border-radius: 30px;
20
  padding: 12px 24px;
 
23
  cursor: pointer;
24
  transition: all 0.3s ease;
25
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
26
+ width: 100%; /* 讓按鈕填滿容器 */
27
+ margin: 20px 0; /* 加入上下邊距 */
28
+ font-size: 1.1em; /* 加大字體 */
29
  }
 
30
  #find-match-btn:hover {
31
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
32
+ opacity: 0.95;
33
+ transform: translateY(-1px); /* 輕微上升效果 */
34
+ }
35
+ #find-match-btn:active {
36
+ transform: translateY(1px); /* 點擊時下壓效果 */
37
  }
 
 
38
  #search-status {
39
  text-align: center;
40
  padding: 10px;
 
277
  print(traceback.format_exc())
278
  return ["Error getting recommendations", gr.HTML.update(visible=False)]
279
 
 
 
 
 
 
 
280
  get_recommendations_btn.click(
281
  fn=on_find_match_click,
282
  inputs=[
 
292
  children_age,
293
  noise_tolerance
294
  ],
295
+ outputs=[recommendation_output, search_status],
296
+ _js="""
297
+ () => {
298
+ document.getElementById('search-status').style.display = 'block';
299
+ return [];
300
+ }
301
+ """ # 立即顯示搜尋狀態
302
  )
303
 
304
  return {