aliabd HF Staff commited on
Commit
f7d0647
·
1 Parent(s): 6032caa

Delete app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +0 -33
app.py DELETED
@@ -1,33 +0,0 @@
1
- import os
2
- from urllib.request import urlretrieve
3
-
4
- import tensorflow as tf
5
-
6
- import gradio
7
- import gradio as gr
8
-
9
- urlretrieve(
10
- "https://gr-models.s3-us-west-2.amazonaws.com/mnist-model.h5", "mnist-model.h5"
11
- )
12
- model = tf.keras.models.load_model("mnist-model.h5")
13
-
14
-
15
- def recognize_digit(image):
16
- image = image.reshape(1, -1)
17
- prediction = model.predict(image).tolist()[0]
18
- return {str(i): prediction[i] for i in range(10)}
19
-
20
-
21
- im = gradio.Image(shape=(28, 28), image_mode="L", invert_colors=False, source="canvas")
22
-
23
- demo = gr.Interface(
24
- recognize_digit,
25
- im,
26
- gradio.Label(num_top_classes=3),
27
- live=True,
28
- interpretation="default",
29
- capture_session=True,
30
- )
31
-
32
- if __name__ == "__main__":
33
- demo.launch()