Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -55,8 +55,13 @@ def predict(img):
|
|
55 |
gray_img = pil_image.convert('L')#grayscale
|
56 |
pic = np.array(gray_img) #convert to array
|
57 |
inp_img=reduce_image_count(pic)#Reduce image to required input size
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
55 |
gray_img = pil_image.convert('L')#grayscale
|
56 |
pic = np.array(gray_img) #convert to array
|
57 |
inp_img=reduce_image_count(pic)#Reduce image to required input size
|
58 |
+
z=Tensor(inp_img)
|
59 |
+
y=z.view(-1,64)
|
60 |
+
x=mdlV2(y)
|
61 |
+
w=F.softmax(x)
|
62 |
+
v=w[0]
|
63 |
+
u=v.data
|
64 |
+
otpt=u
|
65 |
#pred,pred_idx,probs = learn.predict(img)
|
66 |
|
67 |
return dict([[labels[i], float(otpt[i])] for i in range(len(labels))]),inp_img
|