Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,29 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def get_digit(digit_choice):
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
gr.Interface(
|
12 |
fn = get_digit,
|
13 |
#inputs='image',
|
14 |
#inputs=[gr.inputs.Image(label="Input Image", source="webcam")],
|
15 |
inputs = [
|
16 |
-
gr.inputs.Dropdown([0, 1, 2, 3
|
17 |
#gr.inputs.Number()
|
18 |
#'text'
|
19 |
],
|
20 |
#outputs='image',
|
21 |
-
outputs='text',
|
22 |
title='page title',
|
23 |
-
description='page description')
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import tensorflow as tf
|
3 |
+
import keras
|
4 |
+
from keras.datasets import mnist
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
|
7 |
+
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
|
8 |
|
9 |
def get_digit(digit_choice):
|
10 |
+
digit = train_images[digit_choice]
|
11 |
+
fig = plt.imshow(digit)
|
12 |
+
out_txt = "digit: %d" % digit_choice
|
13 |
+
return fig, out_txt
|
14 |
|
15 |
+
iface = gr.Interface(
|
16 |
fn = get_digit,
|
17 |
#inputs='image',
|
18 |
#inputs=[gr.inputs.Image(label="Input Image", source="webcam")],
|
19 |
inputs = [
|
20 |
+
gr.inputs.Dropdown([0, 1, 2, 3),
|
21 |
#gr.inputs.Number()
|
22 |
#'text'
|
23 |
],
|
24 |
#outputs='image',
|
25 |
+
outputs=[gr.outputs.Image(type="plot"), 'text'],
|
26 |
title='page title',
|
27 |
+
description='page description')
|
28 |
+
|
29 |
+
iface.launch()
|