moshel commited on
Commit
3577913
·
1 Parent(s): 13648f6
Files changed (2) hide show
  1. app.py +2 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -53,13 +53,13 @@ def predict(inp):
53
  with torch.no_grad():
54
  prediction = model(img).softmax(1).numpy()
55
  confidences = {labels[i]: float(prediction[0][i]) for i in range(2)}
56
- return confidences
57
 
58
  import gradio as gr
59
 
60
  gr.Interface(fn=predict,
61
  inputs=gr.Image(),
62
- outputs=gr.Label(num_top_classes=1),
63
  ).launch()
64
 
65
 
 
53
  with torch.no_grad():
54
  prediction = model(img).softmax(1).numpy()
55
  confidences = {labels[i]: float(prediction[0][i]) for i in range(2)}
56
+ return confidences, img
57
 
58
  import gradio as gr
59
 
60
  gr.Interface(fn=predict,
61
  inputs=gr.Image(),
62
+ outputs=[gr.Label(num_top_classes=1), "image"],
63
  ).launch()
64
 
65
 
requirements.txt CHANGED
@@ -3,3 +3,4 @@ torchvision
3
  timm==0.8.15dev0
4
  albumentations
5
  opencv-python-headless
 
 
3
  timm==0.8.15dev0
4
  albumentations
5
  opencv-python-headless
6
+ grad-cam