DawnC commited on
Commit
052b7e7
β€’
1 Parent(s): 1befee4

Delete breed_comparison.py

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