DawnC commited on
Commit
def9bd1
1 Parent(s): 1455a21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -194,7 +194,7 @@ def predict(image):
194
  # 檢查最高的預測機率
195
  top1_prob = topk_probs[0][0].item()
196
 
197
- if top1_prob >= 0.6:
198
  # 正確辨識時,返回該品種資訊
199
  predicted = topk_indices[0][0]
200
  breed = dog_breeds[predicted.item()]
@@ -224,7 +224,7 @@ def predict(image):
224
  topk_probs_percent = [f"{prob.item() * 100:.2f}%" for prob in topk_probs[0]]
225
 
226
  # 用粗體返回品種和機率
227
- topk_results = "\n".join([f"**{i+1}. {breed}** ({prob} confidence)" for i, (breed, prob) in enumerate(zip(topk_breeds, topk_probs_percent))])
228
 
229
  # 提供說明
230
  explanation = (
 
194
  # 檢查最高的預測機率
195
  top1_prob = topk_probs[0][0].item()
196
 
197
+ if top1_prob >= 0.5:
198
  # 正確辨識時,返回該品種資訊
199
  predicted = topk_indices[0][0]
200
  breed = dog_breeds[predicted.item()]
 
224
  topk_probs_percent = [f"{prob.item() * 100:.2f}%" for prob in topk_probs[0]]
225
 
226
  # 用粗體返回品種和機率
227
+ topk_results = "\n\n".join([f"**{i+1}. {breed}** ({prob} confidence)" for i, (breed, prob) in enumerate(zip(topk_breeds, topk_probs_percent))])
228
 
229
  # 提供說明
230
  explanation = (