Spaces:
Runtime error
Runtime error
Commit ·
15020c4
1
Parent(s): f65a9bb
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,9 @@ import faiss
|
|
| 10 |
import csv
|
| 11 |
import datetime
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# NO GPU
|
| 15 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
|
@@ -70,7 +73,8 @@ def process(prompt, lang):
|
|
| 70 |
|
| 71 |
# Embed text
|
| 72 |
#from models import *
|
| 73 |
-
encoder_text = tf.keras.models.load_model('encoder_text_retrievaltext_bmg_221022_54.h5')
|
|
|
|
| 74 |
embed_query = encoder_text.predict(embed_prompt["pooled_output"])
|
| 75 |
faiss.normalize_L2(embed_query)
|
| 76 |
print(" text embed computed.")
|
|
|
|
| 10 |
import csv
|
| 11 |
import datetime
|
| 12 |
|
| 13 |
+
from huggingface_hub import hf_hub_download
|
| 14 |
+
file_path = hf_hub_download("PierreHanna/TextRetrieval", "encoder_text_retrievaltext_bmg_221022_54.h5",
|
| 15 |
+
use_auth_token=os.environ['TOKEN'])
|
| 16 |
|
| 17 |
# NO GPU
|
| 18 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
|
|
|
| 73 |
|
| 74 |
# Embed text
|
| 75 |
#from models import *
|
| 76 |
+
#encoder_text = tf.keras.models.load_model('encoder_text_retrievaltext_bmg_221022_54.h5')
|
| 77 |
+
encoder_text = tf.keras.models.load_model(file_path)
|
| 78 |
embed_query = encoder_text.predict(embed_prompt["pooled_output"])
|
| 79 |
faiss.normalize_L2(embed_query)
|
| 80 |
print(" text embed computed.")
|