Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -68,6 +68,11 @@ from datasets import load_dataset
|
|
68 |
from huggingface_hub import HfApi, list_models
|
69 |
import os
|
70 |
from huggingface_hub import HfFileSystem
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
# dataset = load_dataset('Seetha/Visualization', streaming=True)
|
73 |
# df = pd.DataFrame.from_dict(dataset['train'])
|
@@ -153,12 +158,19 @@ def main():
|
|
153 |
class_list.append(i['word'])
|
154 |
entity_list.append(i['entity_group'])
|
155 |
|
156 |
-
filename = 'Checkpoint-classification.sav'
|
157 |
-
loaded_model = pickle.load(open(filename, 'rb'))
|
158 |
-
loaded_vectorizer = pickle.load(open('vectorizefile_classification.pickle', 'rb'))
|
159 |
-
|
160 |
-
pipeline_test_output = loaded_vectorizer.transform(class_list)
|
161 |
-
predicted = loaded_model.predict(pipeline_test_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
pred1 = predicted
|
163 |
level0 = []
|
164 |
count =0
|
|
|
68 |
from huggingface_hub import HfApi, list_models
|
69 |
import os
|
70 |
from huggingface_hub import HfFileSystem
|
71 |
+
from tensorflow.keras.models import Sequential, model_from_json
|
72 |
+
import tensorflow_datasets as tfds
|
73 |
+
import tensorflow as tf
|
74 |
+
|
75 |
+
tfds.disable_progress_bar()
|
76 |
|
77 |
# dataset = load_dataset('Seetha/Visualization', streaming=True)
|
78 |
# df = pd.DataFrame.from_dict(dataset['train'])
|
|
|
158 |
class_list.append(i['word'])
|
159 |
entity_list.append(i['entity_group'])
|
160 |
|
161 |
+
# filename = 'Checkpoint-classification.sav'
|
162 |
+
# loaded_model = pickle.load(open(filename, 'rb'))
|
163 |
+
# loaded_vectorizer = pickle.load(open('vectorizefile_classification.pickle', 'rb'))
|
164 |
+
|
165 |
+
# pipeline_test_output = loaded_vectorizer.transform(class_list)
|
166 |
+
# predicted = loaded_model.predict(pipeline_test_output)
|
167 |
+
json_file = open('model.json', 'r')
|
168 |
+
loaded_model_json = json_file.read()
|
169 |
+
json_file.close()
|
170 |
+
loaded_model = model_from_json(loaded_model_json)
|
171 |
+
# load weights into new model
|
172 |
+
loaded_model.load_weights("model.h5")
|
173 |
+
|
174 |
pred1 = predicted
|
175 |
level0 = []
|
176 |
count =0
|