ISYS commited on
Commit
45d6962
1 Parent(s): 28f8ffd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py CHANGED
@@ -1,3 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import numpy as np
3
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ from tensorflow.keras.datasets import mnist
4
+ from tensorflow import keras
5
+ import keras.backend as K
6
+ from tensorflow.keras.layers import Dense, Flatten, Reshape, Input, Lambda, BatchNormalization, Dropout
7
+
8
+ (x_train, y_train), (x_test, y_test) = mnist.load_data()
9
+
10
+ x_train = x_train / 255
11
+ x_test = x_test / 255
12
+
13
+ y_train = keras.utils.to_categorical(y_train, 10)
14
+
15
+ input_img = Input((28, 28))
16
+ x = Flatten()(input_img)
17
+ x = Dense(256, activation='relu')(x)
18
+ x = Dense(128, activation='relu')(x)
19
+ x = Dense(64, activation='relu')(x)
20
+ Classif = Dense(10, activation='softmax')(x)
21
+
22
+ model = keras.Model(input_img, Classif)
23
+
24
+ model.compile(optimizer='adam', loss='categorical_crossentropy')
25
+
26
+ model.fit(x_train, y_train, epochs=5, batch_size=30, shuffle=True)
27
+
28
+
29
+
30
+
31
  import gradio as gr
32
  import numpy as np
33