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