Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ def reduce_image_count(image):
|
|
| 43 |
for j in range(output_size[1]):
|
| 44 |
block = image[i*block_size[0]:(i+1)*block_size[0], j*block_size[1]:(j+1)*block_size[1]]
|
| 45 |
count = np.count_nonzero(block)
|
| 46 |
-
output[i, j] =
|
| 47 |
|
| 48 |
return output
|
| 49 |
|
|
@@ -64,6 +64,6 @@ def predict(img):
|
|
| 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
|
| 68 |
|
| 69 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(type='filepath'), outputs=[gr.outputs.Label(num_top_classes=10), gr.outputs.Image()]).launch()
|
|
|
|
| 43 |
for j in range(output_size[1]):
|
| 44 |
block = image[i*block_size[0]:(i+1)*block_size[0], j*block_size[1]:(j+1)*block_size[1]]
|
| 45 |
count = np.count_nonzero(block)
|
| 46 |
+
output[i, j] = 16 - ((count / (block_size[0] * block_size[1])) * 1)
|
| 47 |
|
| 48 |
return output
|
| 49 |
|
|
|
|
| 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/16
|
| 68 |
|
| 69 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(type='filepath'), outputs=[gr.outputs.Label(num_top_classes=10), gr.outputs.Image()]).launch()
|