alexluna4 commited on
Commit
3ca7404
·
verified ·
1 Parent(s): a54991c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -47,9 +47,18 @@ def recognize_digit(image):
47
  return {str(i): float(prediction[0][i]) for i in range(10)}
48
  else:
49
  return ""
50
-
 
 
 
 
 
 
 
 
 
51
 
52
  demo = gr.Interface(fn=recognize_digit,
53
- inputs=gr.Image(image_mode="L"),
54
  outputs=gr.Label(num_top_classes=1))
55
  demo.launch(share=True)
 
47
  return {str(i): float(prediction[0][i]) for i in range(10)}
48
  else:
49
  return ""
50
+
51
+ def create_canvas():
52
+ fig, ax = plt.subplots()
53
+ ax.set_title("Draw your digit")
54
+ ax.set_xticks([])
55
+ ax.set_yticks([])
56
+ canvas = FigureCanvas(fig)
57
+ return canvas
58
+
59
+
60
 
61
  demo = gr.Interface(fn=recognize_digit,
62
+ inputs=gr.Image(image_mode="L", source="canvas", canvas=canvas),
63
  outputs=gr.Label(num_top_classes=1))
64
  demo.launch(share=True)