Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,40 +143,6 @@ def preprocess_image(image):
|
|
| 143 |
def get_akc_breeds_link():
|
| 144 |
return "https://www.akc.org/dog-breeds/"
|
| 145 |
|
| 146 |
-
# def predict(image):
|
| 147 |
-
# try:
|
| 148 |
-
# image_tensor = preprocess_image(image)
|
| 149 |
-
# with torch.no_grad():
|
| 150 |
-
# output = model(image_tensor)
|
| 151 |
-
# if isinstance(output, tuple):
|
| 152 |
-
# logits = output[0]
|
| 153 |
-
# else:
|
| 154 |
-
# logits = output
|
| 155 |
-
# _, predicted = torch.max(logits, 1) # predicted is the max value's index on dim=1
|
| 156 |
-
# breed = dog_breeds[predicted.item()]
|
| 157 |
-
|
| 158 |
-
# description = get_dog_description(breed)
|
| 159 |
-
# akc_link = get_akc_breeds_link()
|
| 160 |
-
|
| 161 |
-
# if isinstance(description, dict):
|
| 162 |
-
# description_str = "\n\n".join([f"**{key}**: {value}" for key, value in description.items()])
|
| 163 |
-
# else:
|
| 164 |
-
# description_str = description
|
| 165 |
-
|
| 166 |
-
# # Add AKC link as an option
|
| 167 |
-
# description_str += f"\n\n**Want to learn more about dog breeds?** [Visit the AKC dog breeds page]({akc_link}) and search for {breed} to find detailed information."
|
| 168 |
-
|
| 169 |
-
# # Add disclaimer
|
| 170 |
-
# disclaimer = ("\n\n*Disclaimer: The external link provided leads to the American Kennel Club (AKC) dog breeds page. "
|
| 171 |
-
# "You may need to search for the specific breed on that page. "
|
| 172 |
-
# "I am not responsible for the content on external sites. "
|
| 173 |
-
# "Please refer to the AKC's terms of use and privacy policy.*")
|
| 174 |
-
# description_str += disclaimer
|
| 175 |
-
|
| 176 |
-
# return description_str
|
| 177 |
-
# except Exception as e:
|
| 178 |
-
# return f"An error occurred: {e}"
|
| 179 |
-
|
| 180 |
def predict(image):
|
| 181 |
try:
|
| 182 |
image_tensor = preprocess_image(image)
|
|
|
|
| 143 |
def get_akc_breeds_link():
|
| 144 |
return "https://www.akc.org/dog-breeds/"
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
def predict(image):
|
| 147 |
try:
|
| 148 |
image_tensor = preprocess_image(image)
|