Spaces:
Running
on
Zero
Running
on
Zero
Delete breed_comparison.py
Browse files- breed_comparison.py +0 -125
breed_comparison.py
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
def create_comparison_tab(dog_breeds, get_dog_description):
|
4 |
-
"""εε»Ίεη§ζ―θΎζ ηΎι‘΅
|
5 |
-
|
6 |
-
Args:
|
7 |
-
dog_breeds: ηεη§ε葨
|
8 |
-
get_dog_description: θ·εεη§ζθΏ°ηε½ζ°
|
9 |
-
"""
|
10 |
-
with gr.TabItem("Breed Comparison"):
|
11 |
-
gr.HTML("<p style='text-align: center;'>Select two dog breeds to compare their characteristics and care requirements.</p>")
|
12 |
-
|
13 |
-
with gr.Row():
|
14 |
-
breed1_dropdown = gr.Dropdown(
|
15 |
-
choices=dog_breeds,
|
16 |
-
label="Select First Breed",
|
17 |
-
value="Golden_Retriever"
|
18 |
-
)
|
19 |
-
breed2_dropdown = gr.Dropdown(
|
20 |
-
choices=dog_breeds,
|
21 |
-
label="Select Second Breed",
|
22 |
-
value="Border_Collie"
|
23 |
-
)
|
24 |
-
|
25 |
-
compare_btn = gr.Button("Compare Breeds")
|
26 |
-
comparison_output = gr.HTML(label="Comparison Results")
|
27 |
-
|
28 |
-
def show_comparison(breed1, breed2):
|
29 |
-
if not breed1 or not breed2:
|
30 |
-
return "Please select two breeds to compare"
|
31 |
-
|
32 |
-
breed1_info = get_dog_description(breed1)
|
33 |
-
breed2_info = get_dog_description(breed2)
|
34 |
-
|
35 |
-
html_output = f"""
|
36 |
-
<div class="dog-info-card">
|
37 |
-
<div class="comparison-grid" style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
|
38 |
-
<div class="breed-info">
|
39 |
-
<h2 class="section-title">
|
40 |
-
<span class="icon">π</span> {breed1.replace('_', ' ')}
|
41 |
-
</h2>
|
42 |
-
<div class="info-section">
|
43 |
-
<div class="info-item">
|
44 |
-
<span class="tooltip">
|
45 |
-
<span class="icon">π</span>
|
46 |
-
<span class="label">Size:</span>
|
47 |
-
<span class="value">{breed1_info['Size']}</span>
|
48 |
-
</span>
|
49 |
-
</div>
|
50 |
-
<div class="info-item">
|
51 |
-
<span class="tooltip">
|
52 |
-
<span class="icon">π</span>
|
53 |
-
<span class="label">Exercise Needs:</span>
|
54 |
-
<span class="value">{breed1_info['Exercise Needs']}</span>
|
55 |
-
</span>
|
56 |
-
</div>
|
57 |
-
<div class="info-item">
|
58 |
-
<span class="tooltip">
|
59 |
-
<span class="icon">βοΈ</span>
|
60 |
-
<span class="label">Grooming:</span>
|
61 |
-
<span class="value">{breed1_info['Grooming Needs']}</span>
|
62 |
-
</span>
|
63 |
-
</div>
|
64 |
-
<div class="info-item">
|
65 |
-
<span class="tooltip">
|
66 |
-
<span class="icon">π¨βπ©βπ§βπ¦</span>
|
67 |
-
<span class="label">Good with Children:</span>
|
68 |
-
<span class="value">{breed1_info['Good with Children']}</span>
|
69 |
-
</span>
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
|
74 |
-
<div class="breed-info">
|
75 |
-
<h2 class="section-title">
|
76 |
-
<span class="icon">π</span> {breed2.replace('_', ' ')}
|
77 |
-
</h2>
|
78 |
-
<div class="info-section">
|
79 |
-
<div class="info-item">
|
80 |
-
<span class="tooltip">
|
81 |
-
<span class="icon">π</span>
|
82 |
-
<span class="label">Size:</span>
|
83 |
-
<span class="value">{breed2_info['Size']}</span>
|
84 |
-
</span>
|
85 |
-
</div>
|
86 |
-
<div class="info-item">
|
87 |
-
<span class="tooltip">
|
88 |
-
<span class="icon">π</span>
|
89 |
-
<span class="label">Exercise Needs:</span>
|
90 |
-
<span class="value">{breed2_info['Exercise Needs']}</span>
|
91 |
-
</span>
|
92 |
-
</div>
|
93 |
-
<div class="info-item">
|
94 |
-
<span class="tooltip">
|
95 |
-
<span class="icon">βοΈ</span>
|
96 |
-
<span class="label">Grooming:</span>
|
97 |
-
<span class="value">{breed2_info['Grooming Needs']}</span>
|
98 |
-
</span>
|
99 |
-
</div>
|
100 |
-
<div class="info-item">
|
101 |
-
<span class="tooltip">
|
102 |
-
<span class="icon">π¨βπ©βπ§βπ¦</span>
|
103 |
-
<span class="label">Good with Children:</span>
|
104 |
-
<span class="value">{breed2_info['Good with Children']}</span>
|
105 |
-
</span>
|
106 |
-
</div>
|
107 |
-
</div>
|
108 |
-
</div>
|
109 |
-
</div>
|
110 |
-
</div>
|
111 |
-
"""
|
112 |
-
return html_output
|
113 |
-
|
114 |
-
compare_btn.click(
|
115 |
-
show_comparison,
|
116 |
-
inputs=[breed1_dropdown, breed2_dropdown],
|
117 |
-
outputs=comparison_output
|
118 |
-
)
|
119 |
-
|
120 |
-
return {
|
121 |
-
'breed1_dropdown': breed1_dropdown,
|
122 |
-
'breed2_dropdown': breed2_dropdown,
|
123 |
-
'compare_btn': compare_btn,
|
124 |
-
'comparison_output': comparison_output
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|