Update app.py
Browse files
app.py
CHANGED
|
@@ -26,11 +26,11 @@ def predict(image):
|
|
| 26 |
_, predicted = torch.max(outputs, 1)
|
| 27 |
label = class_names[predicted.item()]
|
| 28 |
print("Predicted label:", label)
|
| 29 |
-
if label in class_ok : result = "
|
| 30 |
-
else : result = "
|
| 31 |
# ์์ธก ๊ฒฐ๊ณผ์ ์๋ณธ ์ถ๋ ฅ๊ฐ์ ๋ชจ๋ ๋ฐํ
|
| 32 |
return result, outputs.numpy() # ์๋ณธ ์ถ๋ ฅ๊ฐ์ NumPy ๋ฐฐ์ด๋ก ๋ณํํ์ฌ ๋ฐํ
|
| 33 |
|
| 34 |
# Gradio ์ธํฐํ์ด์ค ์ค์ (๋ ๊ฐ์ ์ถ๋ ฅ)
|
| 35 |
-
iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs=['label'
|
| 36 |
iface.launch()
|
|
|
|
| 26 |
_, predicted = torch.max(outputs, 1)
|
| 27 |
label = class_names[predicted.item()]
|
| 28 |
print("Predicted label:", label)
|
| 29 |
+
if label in class_ok : result = "์ธ์ฆ์ด ์๋ฃ๋์์ต๋๋ค. (+1p)"
|
| 30 |
+
else : result = "์ธ์ฆ์ ์คํจํ์ต๋๋ค. (-)"
|
| 31 |
# ์์ธก ๊ฒฐ๊ณผ์ ์๋ณธ ์ถ๋ ฅ๊ฐ์ ๋ชจ๋ ๋ฐํ
|
| 32 |
return result, outputs.numpy() # ์๋ณธ ์ถ๋ ฅ๊ฐ์ NumPy ๋ฐฐ์ด๋ก ๋ณํํ์ฌ ๋ฐํ
|
| 33 |
|
| 34 |
# Gradio ์ธํฐํ์ด์ค ์ค์ (๋ ๊ฐ์ ์ถ๋ ฅ)
|
| 35 |
+
iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs=['label'], live=True)
|
| 36 |
iface.launch()
|