junecv commited on
Commit
b568e76
·
1 Parent(s): 02ecdeb

update app with model in .h5

Browse files
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
app.py CHANGED
@@ -4,12 +4,25 @@ import tensorflow as tf
4
  from tensorflow.keras import layers
5
 
6
  # retrieve text vectorization layer
7
- tv_spec = pkl.load(Open('saved_model/tv_layer.pkl', 'rb'))
8
  text_vectorizer = layers.TextVectorization.from_config(tv_spec['config'])
9
  text_vectorizer.set_weights(tv_spec['weights'])
10
 
11
- # load model
12
- model = tf.keras.models.load_model('saved_model/dnn_model')
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # get input
15
  text = st.text_input('check if you\'re the \U0001F437', 'Hi Disky, how is your business doing?')
 
4
  from tensorflow.keras import layers
5
 
6
  # retrieve text vectorization layer
7
+ tv_spec = pkl.load(Open('model/tv_layer.pkl', 'rb'))
8
  text_vectorizer = layers.TextVectorization.from_config(tv_spec['config'])
9
  text_vectorizer.set_weights(tv_spec['weights'])
10
 
11
+ # function to create model Simple DNN
12
+ def get_model(hidden_dim = 8):
13
+ inputs = keras.Input(shape=(35,), dtype = "int64")
14
+ x = layers.Dense(hidden_dim, activation = "relu")(inputs)
15
+ outputs = layers.Dense(1, activation = 'sigmoid')(x)
16
+ model = keras.Model(inputs, outputs)
17
+ model.compile(
18
+ loss = "binary_crossentropy",
19
+ optimizer = keras.optimizers.Adam(learning_rate = 0.01),
20
+ metrics = ['accuracy']
21
+ )
22
+ return model
23
+
24
+ model = get_model()
25
+ model.load_weights('model/dnn_model.h5')
26
 
27
  # get input
28
  text = st.text_input('check if you\'re the \U0001F437', 'Hi Disky, how is your business doing?')
saved_model/dnn_model/.DS_Store → model/dnn_model.h5 RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fa949bfb37b9abac0377410a416813ce348383b0a80099614bffaaf58716fe19
3
- size 6148
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b8797eed0f2ed83f8a468a9ffc57d6aa47fea50581a0382ec6bb7abed0541ca
3
+ size 14824
{saved_model → model}/tv_layer.pkl RENAMED
File without changes
saved_model/dnn_model/keras_metadata.pb DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2b0ad4784955f29a9d47aaa2e27317514fc6920758d474bf594cff0338bb99b1
3
- size 7056
 
 
 
 
saved_model/dnn_model/saved_model.pb DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3e3b4419264eba07c9d499915bf89de8b88a6d691e6e355e6a307f2f6f1a0df7
3
- size 65794
 
 
 
 
saved_model/dnn_model/variables/variables.data-00000-of-00001 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:43960510c2a9c739f5dcf67e8f5a9a110095d15cd1d620b8d1ed25001d59334f
3
- size 7946
 
 
 
 
saved_model/dnn_model/variables/variables.index DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3634b77cc09ab71c63efffb82a67d2223939e16e5b65fd94b6f29caf3beec262
3
- size 1410