import gradio as gr def create_description_search_tab() -> gr.Column: """創建描述搜索頁面的UI組件""" guide_html = """

🐾 Describe Your Ideal Dog

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

📏

Size Preference

Small • Medium • Large

🏃

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. I live in an apartment and can provide moderate exercise. Looking for an intelligent breed that's easy to train...", lines=5 ) # 搜索按鈕(使用 Gradio 默認顏色) search_button = gr.Button( "Find My Perfect Match! 🔍", variant="primary", size="lg" ) # 結果顯示區域 result_output = gr.HTML(label="Breed Recommendations") return description_input, search_button, result_output def create_description_search_tab() -> gr.Column: """創建描述搜索頁面的UI組件""" guide_html = """

🐾 Describe Your Ideal Dog

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

📏

Size Preference

Small • Medium • Large

🏃

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 15-20 seconds while we analyze your preferences.

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