Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -317,7 +317,7 @@ def predict(image):
|
|
| 317 |
print(f" Is dog: {is_dog}")
|
| 318 |
print(f" Detection confidence: {detection_confidence:.4f}")
|
| 319 |
|
| 320 |
-
#
|
| 321 |
if is_dog:
|
| 322 |
top1_prob, topk_breeds, relative_probs = predict_single_dog(cropped_image)
|
| 323 |
print(f" Breed prediction - Top probability: {top1_prob:.4f}")
|
|
@@ -389,7 +389,7 @@ def predict(image):
|
|
| 389 |
print(f"Error formatting results for dog {i+1}: {str(e)}")
|
| 390 |
dogs_info += format_unknown_breed_message(color, i+1)
|
| 391 |
|
| 392 |
-
#
|
| 393 |
html_output = format_multi_dog_container(dogs_info)
|
| 394 |
|
| 395 |
# 準備初始狀態
|
|
@@ -486,7 +486,6 @@ def main():
|
|
| 486 |
history_component=history_component
|
| 487 |
)
|
| 488 |
|
| 489 |
-
|
| 490 |
# 4. 最後創建歷史記錄標籤頁
|
| 491 |
create_history_tab(history_component)
|
| 492 |
|
|
|
|
| 317 |
print(f" Is dog: {is_dog}")
|
| 318 |
print(f" Detection confidence: {detection_confidence:.4f}")
|
| 319 |
|
| 320 |
+
# 如果是狗且進行品種預測
|
| 321 |
if is_dog:
|
| 322 |
top1_prob, topk_breeds, relative_probs = predict_single_dog(cropped_image)
|
| 323 |
print(f" Breed prediction - Top probability: {top1_prob:.4f}")
|
|
|
|
| 389 |
print(f"Error formatting results for dog {i+1}: {str(e)}")
|
| 390 |
dogs_info += format_unknown_breed_message(color, i+1)
|
| 391 |
|
| 392 |
+
# 最終的HTML
|
| 393 |
html_output = format_multi_dog_container(dogs_info)
|
| 394 |
|
| 395 |
# 準備初始狀態
|
|
|
|
| 486 |
history_component=history_component
|
| 487 |
)
|
| 488 |
|
|
|
|
| 489 |
# 4. 最後創建歷史記錄標籤頁
|
| 490 |
create_history_tab(history_component)
|
| 491 |
|