Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,11 @@
|
|
1 |
-
import cv2
|
2 |
import gradio as gr
|
3 |
-
import tensorflow as tf
|
4 |
-
import numpy as np
|
5 |
|
6 |
|
7 |
-
|
|
|
8 |
|
9 |
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
img = img.reshape(1, 28, 28) / 255.0
|
14 |
-
|
15 |
-
# Make the prediction
|
16 |
-
prediction = model.predict(img)
|
17 |
-
predicted_digit = np.argmax(prediction[0])
|
18 |
-
|
19 |
-
return predicted_digit
|
20 |
-
|
21 |
-
with gr.Blocks() as demo:
|
22 |
-
gr.Markdown("Welcome on your first sketch recognition app!")
|
23 |
-
|
24 |
-
with gr.Row():
|
25 |
-
scratchpad = gr.Scratchpad(shape=(28, 28))
|
26 |
-
output = gr.Text()
|
27 |
-
|
28 |
-
btn = gr.Button("Submit")
|
29 |
-
btn.click(predict, inputs=scratchpad, outputs=output)
|
30 |
-
|
31 |
-
demo.launch()
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
|
4 |
+
def greet(name):
|
5 |
+
return "Hello " + name + "!"
|
6 |
|
7 |
|
8 |
+
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
9 |
|
10 |
+
if __name__ == "__main__":
|
11 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|