DawnC commited on
Commit
ceb6dca
·
1 Parent(s): 15916d8

Update description_search_ui.py

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