Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -170,6 +170,10 @@ def preprocess_image(image):
|
|
170 |
# except Exception as e:
|
171 |
# return f"An error occurred: {e}"
|
172 |
|
|
|
|
|
|
|
|
|
173 |
def predict(image):
|
174 |
try:
|
175 |
image_tensor = preprocess_image(image)
|
@@ -185,8 +189,8 @@ def predict(image):
|
|
185 |
# Retrieve breed description
|
186 |
description = get_dog_description(breed)
|
187 |
|
188 |
-
# Generate
|
189 |
-
|
190 |
|
191 |
# Formatting the description for better display
|
192 |
if isinstance(description, dict):
|
@@ -202,8 +206,8 @@ def predict(image):
|
|
202 |
else:
|
203 |
description_str = description
|
204 |
|
205 |
-
# Add
|
206 |
-
description_str += f"\n\n[Click here
|
207 |
|
208 |
return description_str
|
209 |
except Exception as e:
|
|
|
170 |
# except Exception as e:
|
171 |
# return f"An error occurred: {e}"
|
172 |
|
173 |
+
def get_akc_link(breed):
|
174 |
+
formatted_breed = breed.lower().replace(" ", "-")
|
175 |
+
return f"https://www.akc.org/dog-breeds/{formatted_breed}/"
|
176 |
+
|
177 |
def predict(image):
|
178 |
try:
|
179 |
image_tensor = preprocess_image(image)
|
|
|
189 |
# Retrieve breed description
|
190 |
description = get_dog_description(breed)
|
191 |
|
192 |
+
# Generate AKC link
|
193 |
+
akc_link = get_akc_link(breed)
|
194 |
|
195 |
# Formatting the description for better display
|
196 |
if isinstance(description, dict):
|
|
|
206 |
else:
|
207 |
description_str = description
|
208 |
|
209 |
+
# Add AKC link
|
210 |
+
description_str += f"\n\n[Click here for more information about {breed} on AKC]({akc_link})"
|
211 |
|
212 |
return description_str
|
213 |
except Exception as e:
|