Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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[
|
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)
|