Spaces:
Runtime error
Runtime error
Commit Β·
e38c032
1
Parent(s): c7e307d
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,13 @@ import sys
|
|
| 8 |
import numpy as np
|
| 9 |
import faiss
|
| 10 |
import csv
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# NO GPU
|
| 13 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
| 14 |
-
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def make_bert_preprocess_model(sentence_features, tfhub_handle_preprocess, seq_length=128):
|
|
@@ -53,6 +56,8 @@ def process(prompt, lang):
|
|
| 53 |
bert_preprocess_model = make_bert_preprocess_model(['my_input'], tfhub_handle_preprocess, seq_length = MAX_LENGTH)
|
| 54 |
bert_model = hub.KerasLayer(tfhub_handle_encoder)
|
| 55 |
|
|
|
|
|
|
|
| 56 |
print("Text input : ", prompt)
|
| 57 |
prompt=[prompt]
|
| 58 |
text_preprocessed = bert_preprocess_model([np.array(prompt)])
|
|
|
|
| 8 |
import numpy as np
|
| 9 |
import faiss
|
| 10 |
import csv
|
| 11 |
+
import datetime
|
| 12 |
+
|
| 13 |
|
| 14 |
# NO GPU
|
| 15 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
| 16 |
+
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
| 17 |
+
|
| 18 |
|
| 19 |
|
| 20 |
def make_bert_preprocess_model(sentence_features, tfhub_handle_preprocess, seq_length=128):
|
|
|
|
| 56 |
bert_preprocess_model = make_bert_preprocess_model(['my_input'], tfhub_handle_preprocess, seq_length = MAX_LENGTH)
|
| 57 |
bert_model = hub.KerasLayer(tfhub_handle_encoder)
|
| 58 |
|
| 59 |
+
now = datetime.datetime.now()
|
| 60 |
+
print("Current date and time: ", str(now))
|
| 61 |
print("Text input : ", prompt)
|
| 62 |
prompt=[prompt]
|
| 63 |
text_preprocessed = bert_preprocess_model([np.array(prompt)])
|