Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ def classify_mushroom(image: Image.Image):
|
|
60 |
if score < CONFIDENCE_THRESHOLD:
|
61 |
label = "Uncertain"
|
62 |
|
63 |
-
return label, ("กินได้" if label == "Edible" else ("พิษ" if label == "Poisonous" else "ไม่มั่นใจ")), f"{score:.2f}%", suggestion
|
64 |
|
65 |
except Exception as e:
|
66 |
print(f"❌ Error: {e}")
|
@@ -77,7 +77,7 @@ if __name__ == "__main__":
|
|
77 |
gr.Markdown("Upload a mushroom photo or use your camera to check if it’s edible or poisonous.\nอัปโหลดรูปเห็ดหรือใช้กล้องเพื่อตรวจสอบว่าเห็ดกินได้หรือมีพิษ")
|
78 |
|
79 |
with gr.Row():
|
80 |
-
image_input = gr.Image(type="pil", label="📷 Upload or Capture Mushroom Image"
|
81 |
with gr.Column():
|
82 |
label_en = gr.Textbox(label="🧬 Prediction (English)")
|
83 |
label_th = gr.Textbox(label="🔁 คำทำนาย (ภาษาไทย)")
|
|
|
60 |
if score < CONFIDENCE_THRESHOLD:
|
61 |
label = "Uncertain"
|
62 |
|
63 |
+
return label, ("กินได้" if label == "Edible" else ("พิษ" if label == "Poisonous" else "ไม่มั่นใจ (Confidence score < 85%)")), f"{score:.2f}%", suggestion
|
64 |
|
65 |
except Exception as e:
|
66 |
print(f"❌ Error: {e}")
|
|
|
77 |
gr.Markdown("Upload a mushroom photo or use your camera to check if it’s edible or poisonous.\nอัปโหลดรูปเห็ดหรือใช้กล้องเพื่อตรวจสอบว่าเห็ดกินได้หรือมีพิษ")
|
78 |
|
79 |
with gr.Row():
|
80 |
+
image_input = gr.Image(type="pil", label="📷 Upload or Capture Mushroom Image")
|
81 |
with gr.Column():
|
82 |
label_en = gr.Textbox(label="🧬 Prediction (English)")
|
83 |
label_th = gr.Textbox(label="🔁 คำทำนาย (ภาษาไทย)")
|