Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,14 +16,14 @@ hf_token = os.getenv("HF_TOKEN")
|
|
16 |
|
17 |
login(token=hf_token)
|
18 |
|
19 |
-
def
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
23 |
faiss_index = faiss.read_index(faiss_index_path)
|
24 |
-
|
25 |
-
with open(embeddings_path, 'rb') as f:
|
26 |
-
question_embeddings = pickle.load(f)
|
27 |
|
28 |
return faiss_index, question_embeddings
|
29 |
|
@@ -87,7 +87,6 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
87 |
|
88 |
|
89 |
|
90 |
-
# Gradio ChatInterface with additional inputs for model settings and response time
|
91 |
demo = gr.ChatInterface(
|
92 |
fn=respond,
|
93 |
additional_inputs=[
|
|
|
16 |
|
17 |
login(token=hf_token)
|
18 |
|
19 |
+
def load_embeddings_and_faiss():
|
20 |
+
embeddings_path = hf_hub_download(repo_id="chukbert/embedding-faq-medquad", filename="data/embeddings-00000-of-00001.parquet")
|
21 |
+
faiss_index_path = hf_hub_download(repo_id="chukbert/embedding-faq-medquad", filename="data/faiss_index-00000-of-00001.parquet")
|
22 |
+
|
23 |
+
embeddings_df = pd.read_parquet(embeddings_path)
|
24 |
+
question_embeddings = embeddings_df.values
|
25 |
+
|
26 |
faiss_index = faiss.read_index(faiss_index_path)
|
|
|
|
|
|
|
27 |
|
28 |
return faiss_index, question_embeddings
|
29 |
|
|
|
87 |
|
88 |
|
89 |
|
|
|
90 |
demo = gr.ChatInterface(
|
91 |
fn=respond,
|
92 |
additional_inputs=[
|