Ammar971 commited on
Commit
6b2792f
·
1 Parent(s): 9121609

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -7
app.py CHANGED
@@ -1,12 +1,33 @@
1
  import gradio as gr
2
 
3
- def greet(name, is_morning, temp):
4
- salutatuin = "Gm" if is_morning else "Ge"
5
- greeting = f"{salutatuin} {name}. It is {temp} degress today"
6
- celsius = (temp - 32) * 5 /9
7
- return greeting, round(celsius, 2)
8
 
 
 
9
 
10
- demo = gr.Interface(fn=greet, inputs=["text", "checkbox", gr.Slider(0,50)], outputs=["text", "number"])
 
11
 
12
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ import tensorflow as tf
4
+ import keras
5
+ from matplotlib import pyplot as plt
6
+ import numpy as np
 
7
 
8
+ objects = tf.keras.datasets.mnist
9
+ (training_images, training_labels), (test_images, test_labels) = objects.load_data()
10
 
11
+ training_images = training_images / 255.0
12
+ test_images = test_images / 255.0
13
 
14
+ from keras.layers import Flatten, Dense
15
+ model = tf.keras.models.Sequential([Flatten(input_shape=(28,28)),
16
+ Dense(256, activation='relu'),
17
+ Dense(256, activation='relu'),
18
+ Dense(128, activation='relu'),
19
+ Dense(10, activation=tf.nn.softmax)])
20
+
21
+ model.compile(optimizer = 'adam',
22
+ loss = 'sparse_categorical_crossentropy',
23
+ metrics=['accuracy'])
24
+
25
+ model.fit(training_images, training_labels, epochs=10)
26
+
27
+ test=test_images[0].reshape(-1,28,28)
28
+ pred=model.predict(test)
29
+ print(pred)
30
+
31
+ iface = gr.Interface(predict_image, inputs="sketchpad", outputs="label")
32
+
33
+ iface.launch(debug='True')