DavidD003 commited on
Commit
97dfb29
·
1 Parent(s): 831cba9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -56,9 +56,9 @@ def predict(img):
56
  pic = np.array(gray_img) #convert to array
57
  inp_img=reduce_image_count(pic)#Reduce image to required input size
58
 
59
- otpt=F.softmax(mdlV2(inp_img.view(-1,64)))
60
  #pred,pred_idx,probs = learn.predict(img)
61
 
62
- return dict([[labels[i], float(otpt[0].data[i])] for i in range(len(labels))]),inp_img
63
 
64
  gr.Interface(fn=predict, inputs=gr.inputs.Image(type='filepath'), outputs=[gr.outputs.Label(num_top_classes=10), gr.outputs.Image()]).launch(share=True)
 
56
  pic = np.array(gray_img) #convert to array
57
  inp_img=reduce_image_count(pic)#Reduce image to required input size
58
 
59
+ otpt=F.softmax(mdlV2(Tensor(inp_img.view(-1,64))))[0].data
60
  #pred,pred_idx,probs = learn.predict(img)
61
 
62
+ return dict([[labels[i], float(otpt[i])] for i in range(len(labels))]),inp_img
63
 
64
  gr.Interface(fn=predict, inputs=gr.inputs.Image(type='filepath'), outputs=[gr.outputs.Label(num_top_classes=10), gr.outputs.Image()]).launch(share=True)