import gradio as gr def create_description_search_tab(): """創建描述搜尋頁面的UI程式碼""" guide_html = """

🐾 Describe Your Ideal Dog

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...

This might take a little longer on the first try — our AI is warming up its paws! 🐾 Please allow up to 45 seconds for the best results. Thanks for your patience!

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