Spaces:
Running
on
Zero
Running
on
Zero
Delete description_search_ui.py
Browse files- description_search_ui.py +0 -161
description_search_ui.py
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
def create_description_search_tab():
|
4 |
-
"""創建描述搜索頁面的UI程式碼"""
|
5 |
-
guide_html = """
|
6 |
-
<div class="breed-search-container">
|
7 |
-
<div class="description-guide">
|
8 |
-
<h2 class="guide-title">🐾 Describe Your Ideal Dog</h2>
|
9 |
-
|
10 |
-
<div class="guide-content">
|
11 |
-
<p class="intro-text">Help us find your perfect companion! Please consider including the following details:</p>
|
12 |
-
|
13 |
-
<div class="criteria-grid">
|
14 |
-
<div class="criteria-item">
|
15 |
-
<span class="icon">📏</span>
|
16 |
-
<div class="criteria-content">
|
17 |
-
<h3>Size Preference</h3>
|
18 |
-
<p>Small • Medium • Large</p>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<div class="criteria-item">
|
23 |
-
<span class="icon">🏃</span>
|
24 |
-
<div class="criteria-content">
|
25 |
-
<h3>Activity Level</h3>
|
26 |
-
<p>Low • Moderate • High • Very Active</p>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
|
30 |
-
<div class="criteria-item">
|
31 |
-
<span class="icon">🏠</span>
|
32 |
-
<div class="criteria-content">
|
33 |
-
<h3>Living Environment</h3>
|
34 |
-
<p>Apartment • House • Yard Space</p>
|
35 |
-
</div>
|
36 |
-
</div>
|
37 |
-
|
38 |
-
<div class="criteria-item">
|
39 |
-
<span class="icon">👨👩👧👦</span>
|
40 |
-
<div class="criteria-content">
|
41 |
-
<h3>Family Situation</h3>
|
42 |
-
<p>Children • Other Pets • Single Adult</p>
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
|
46 |
-
<div class="criteria-item">
|
47 |
-
<span class="icon">✂️</span>
|
48 |
-
<div class="criteria-content">
|
49 |
-
<h3>Grooming Commitment</h3>
|
50 |
-
<p>Low • Medium • High Maintenance</p>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
|
54 |
-
<div class="criteria-item">
|
55 |
-
<span class="icon">🎭</span>
|
56 |
-
<div class="criteria-content">
|
57 |
-
<h3>Desired Personality</h3>
|
58 |
-
<p>Friendly • Independent • Intelligent • Calm</p>
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
</div>
|
62 |
-
</div>
|
63 |
-
</div>
|
64 |
-
</div>
|
65 |
-
"""
|
66 |
-
|
67 |
-
# 增加 CSS 的樣式
|
68 |
-
css = """
|
69 |
-
<style>
|
70 |
-
.breed-search-container {
|
71 |
-
background: white;
|
72 |
-
border-radius: 12px;
|
73 |
-
padding: 24px;
|
74 |
-
margin-bottom: 20px;
|
75 |
-
}
|
76 |
-
|
77 |
-
.guide-title {
|
78 |
-
font-size: 1.8rem;
|
79 |
-
color: #2c3e50;
|
80 |
-
margin-bottom: 20px;
|
81 |
-
text-align: center;
|
82 |
-
}
|
83 |
-
|
84 |
-
.intro-text {
|
85 |
-
color: #666;
|
86 |
-
text-align: center;
|
87 |
-
margin-bottom: 24px;
|
88 |
-
font-size: 1.1rem;
|
89 |
-
}
|
90 |
-
|
91 |
-
.criteria-grid {
|
92 |
-
display: grid;
|
93 |
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
94 |
-
gap: 20px;
|
95 |
-
margin-bottom: 24px;
|
96 |
-
}
|
97 |
-
|
98 |
-
.criteria-item {
|
99 |
-
display: flex;
|
100 |
-
align-items: flex-start;
|
101 |
-
padding: 16px;
|
102 |
-
background: #f8fafc;
|
103 |
-
border-radius: 8px;
|
104 |
-
transition: all 0.3s ease;
|
105 |
-
}
|
106 |
-
|
107 |
-
.criteria-item:hover {
|
108 |
-
transform: translateY(-2px);
|
109 |
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
110 |
-
}
|
111 |
-
|
112 |
-
.criteria-item .icon {
|
113 |
-
font-size: 24px;
|
114 |
-
margin-right: 12px;
|
115 |
-
margin-top: 3px;
|
116 |
-
}
|
117 |
-
|
118 |
-
.criteria-content h3 {
|
119 |
-
font-size: 1.1rem;
|
120 |
-
color: #2c3e50;
|
121 |
-
margin: 0 0 4px 0;
|
122 |
-
}
|
123 |
-
|
124 |
-
.criteria-content p {
|
125 |
-
color: #666;
|
126 |
-
margin: 0;
|
127 |
-
font-size: 0.95rem;
|
128 |
-
}
|
129 |
-
</style>
|
130 |
-
"""
|
131 |
-
|
132 |
-
with gr.Column():
|
133 |
-
# 顯示指南和樣式
|
134 |
-
gr.HTML(css + guide_html)
|
135 |
-
|
136 |
-
# 描述輸入區
|
137 |
-
description_input = gr.Textbox(
|
138 |
-
label="",
|
139 |
-
placeholder="Example: I'm looking for a medium-sized, friendly dog that's good with kids...",
|
140 |
-
lines=5
|
141 |
-
)
|
142 |
-
|
143 |
-
# 搜索按鈕
|
144 |
-
search_button = gr.Button(
|
145 |
-
"Find My Perfect Match! 🔍",
|
146 |
-
variant="primary",
|
147 |
-
size="lg"
|
148 |
-
)
|
149 |
-
|
150 |
-
# 加載消息
|
151 |
-
loading_msg = gr.HTML("""
|
152 |
-
<div style='text-align: center; color: #666;'>
|
153 |
-
<p><b>Finding your perfect match...</b></p>
|
154 |
-
<p>Please wait 15-20 seconds while we analyze your preferences.</p>
|
155 |
-
</div>
|
156 |
-
""", visible=False)
|
157 |
-
|
158 |
-
# 結果顯示區域
|
159 |
-
result_output = gr.HTML(label="Breed Recommendations")
|
160 |
-
|
161 |
-
return description_input, search_button, result_output, loading_msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|