Cheomjee commited on
Commit
c446819
ยท
verified ยท
1 Parent(s): 6b13e81

Update app_dict.py

Browse files
Files changed (1) hide show
  1. app_dict.py +3 -3
app_dict.py CHANGED
@@ -39,10 +39,10 @@ def predict(image):
39
  print("Raw outputs:", outputs) # ์›๋ณธ ์ถœ๋ ฅ๊ฐ’ ํ™•์ธ
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)
 
39
  print("Raw outputs:", outputs) # ์›๋ณธ ์ถœ๋ ฅ๊ฐ’ ํ™•์ธ
40
  _, predicted = torch.max(outputs, 1)
41
  label = class_names[predicted.item()]
42
+ if label in ['disposablecup','label'] : result = "Failed"
43
+ else : result = "Successed (+1)"
44
  # ์˜ˆ์ธก ๊ฒฐ๊ณผ์™€ ์›๋ณธ ์ถœ๋ ฅ๊ฐ’์„ ๋ชจ๋‘ ๋ฐ˜ํ™˜
45
+ return result # ์›๋ณธ ์ถœ๋ ฅ๊ฐ’์„ NumPy ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋ฐ˜ํ™˜
46
 
47
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ • (๋‘ ๊ฐœ์˜ ์ถœ๋ ฅ)
48
  iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs=['label', 'numpy'], live=True)