import gradio as gr def create_description_search_tab(): """顯示描述搜尋頁面的UI""" guide_html = """
BETA

🐾 Describe Your Ideal Dog

🔬 Beta Feature: We're continuously improving our breed description matching. Results may vary.

Help us find your perfect companion! Please consider including the following details:

🏃

Activity Level

Low • Moderate • High • Very Active

🏠

Living Environment

Apartment • House • Yard Space

👨‍👩‍👧‍👦

Family Situation

Children • Other Pets • Single Adult

✂️

Grooming Commitment

Low • Medium • High Maintenance

🎭

Desired Personality

Friendly • Independent • Intelligent • Calm

""" # 增加 CSS 的樣式 css = """ """ with gr.Column(): # 顯示指南和樣式 gr.HTML(css + guide_html) # 描述輸入區 description_input = gr.Textbox( label="", placeholder="Example: I'm looking for a medium-sized, friendly dog that's good with kids...", lines=5 ) # 搜索按鈕 search_button = gr.Button( "Find My Perfect Match! 🔍", variant="primary", size="lg" ) # 加載消息 loading_msg = gr.HTML("""

Finding your perfect match...

Please wait 25-30 seconds while we analyze your preferences.

""", visible=False) # 結果顯示區域 result_output = gr.HTML(label="Breed Recommendations") return description_input, search_button, result_output, loading_msg