DawnC commited on
Commit
421e857
1 Parent(s): 127de69

Update description_search_ui.py

Browse files
Files changed (1) hide show
  1. description_search_ui.py +3 -22
description_search_ui.py CHANGED
@@ -154,7 +154,7 @@ import gradio as gr
154
  # return description_input, search_button, result_output
155
 
156
 
157
- def create_description_search_tab():
158
  """創建描述搜索頁面的UI組件"""
159
  guide_html = """
160
  <div class="breed-search-container">
@@ -294,8 +294,7 @@ def create_description_search_tab():
294
 
295
  # 加載狀態和結果區域
296
  with gr.Column() as output_area:
297
- result_output = gr.HTML(label="Breed Recommendations")
298
- loading_status = gr.HTML(visible=False, value="""
299
  <div style="text-align: center; padding: 2rem;">
300
  <div style="display: inline-block; width: 40px; height: 40px; border: 4px solid #f3f3f3;
301
  border-top: 4px solid #3498db; border-radius: 50%; margin-bottom: 1rem;
@@ -316,24 +315,6 @@ def create_description_search_tab():
316
  </div>
317
  </div>
318
  """)
319
-
320
- def on_button_click():
321
- return gr.update(visible=True), gr.update(visible=False)
322
-
323
- # 點擊按鈕時顯示加載狀態
324
- search_button.click(
325
- fn=on_button_click,
326
- inputs=[],
327
- outputs=[loading_status, result_output],
328
- queue=False
329
- ).then(
330
- fn=on_description_search,
331
- inputs=[description_input],
332
- outputs=[result_output]
333
- ).then(
334
- fn=lambda: (gr.update(visible=False), gr.update(visible=True)),
335
- inputs=[],
336
- outputs=[loading_status, result_output]
337
- )
338
 
339
  return description_input, search_button, result_output
 
154
  # return description_input, search_button, result_output
155
 
156
 
157
+ def create_description_search_tab() -> gr.Column:
158
  """創建描述搜索頁面的UI組件"""
159
  guide_html = """
160
  <div class="breed-search-container">
 
294
 
295
  # 加載狀態和結果區域
296
  with gr.Column() as output_area:
297
+ loading_info = gr.HTML(visible=True, value="""
 
298
  <div style="text-align: center; padding: 2rem;">
299
  <div style="display: inline-block; width: 40px; height: 40px; border: 4px solid #f3f3f3;
300
  border-top: 4px solid #3498db; border-radius: 50%; margin-bottom: 1rem;
 
315
  </div>
316
  </div>
317
  """)
318
+ result_output = gr.HTML(label="Breed Recommendations")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
  return description_input, search_button, result_output