kjn1009 commited on
Commit
55c6bb4
ยท
verified ยท
1 Parent(s): ac1d126

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -40,9 +40,11 @@ def predict(image):
40
  _, predicted = torch.max(outputs, 1)
41
  label = class_names[predicted.item()]
42
  print("Predicted label:", label)
43
- return label
 
 
44
 
45
-
46
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
47
- iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs='label', live=True)
48
  iface.launch()
 
 
40
  _, predicted = torch.max(outputs, 1)
41
  label = class_names[predicted.item()]
42
  print("Predicted label:", label)
43
+
44
+ # ์˜ˆ์ธก ๊ฒฐ๊ณผ์™€ ์›๋ณธ ์ถœ๋ ฅ๊ฐ’์„ ๋ชจ๋‘ ๋ฐ˜ํ™˜
45
+ return label, outputs.numpy() # ์›๋ณธ ์ถœ๋ ฅ๊ฐ’์„ NumPy ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋ฐ˜ํ™˜
46
 
47
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ • (๋‘ ๊ฐœ์˜ ์ถœ๋ ฅ)
48
+ iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs=['label', 'numpy'], live=True)
 
49
  iface.launch()
50
+