Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import tensorflow as tf
|
| 3 |
import tensorflow_hub as hub
|
|
@@ -7,15 +11,11 @@ from tensorflow.keras.models import load_model
|
|
| 7 |
from official.nlp.data import classifier_data_lib
|
| 8 |
from official.nlp.tools import tokenization
|
| 9 |
import joblib
|
| 10 |
-
|
| 11 |
import gradio as gr
|
| 12 |
|
| 13 |
model = load_model('best_model.h5', custom_objects={'KerasLayer': hub.KerasLayer})
|
| 14 |
|
| 15 |
-
with zipfile.ZipFile('model.zip', 'r') as zip_ref:
|
| 16 |
-
zip_ref.extractall('model')
|
| 17 |
-
|
| 18 |
-
|
| 19 |
vocab_file = model.resolved_object.vocab_file.asset_path.numpy()
|
| 20 |
do_lower_case = model.resolved_object.do_lower_case.numpy()
|
| 21 |
tokenizer = tokenization.FullTokenizer(vocab_file,do_lower_case)
|
|
|
|
| 1 |
+
import zipfile
|
| 2 |
+
with zipfile.ZipFile('model.zip', 'r') as zip_ref:
|
| 3 |
+
zip_ref.extractall('model')
|
| 4 |
+
|
| 5 |
import numpy as np
|
| 6 |
import tensorflow as tf
|
| 7 |
import tensorflow_hub as hub
|
|
|
|
| 11 |
from official.nlp.data import classifier_data_lib
|
| 12 |
from official.nlp.tools import tokenization
|
| 13 |
import joblib
|
| 14 |
+
|
| 15 |
import gradio as gr
|
| 16 |
|
| 17 |
model = load_model('best_model.h5', custom_objects={'KerasLayer': hub.KerasLayer})
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
vocab_file = model.resolved_object.vocab_file.asset_path.numpy()
|
| 20 |
do_lower_case = model.resolved_object.do_lower_case.numpy()
|
| 21 |
tokenizer = tokenization.FullTokenizer(vocab_file,do_lower_case)
|