Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,13 @@
|
|
| 1 |
import pickle
|
| 2 |
import gradio as gr
|
| 3 |
from chatbot import answer_query_with_context
|
| 4 |
-
from file_utils import
|
| 5 |
|
| 6 |
database_filepath = 'services-links.csv'
|
| 7 |
embeddings_filepath = 'document_embeddings.pkl'
|
| 8 |
|
| 9 |
-
database =
|
| 10 |
-
database_embeddings =
|
| 11 |
-
|
| 12 |
-
# # If the database has been updated recently, uncomment this block to run the following code to
|
| 13 |
-
# # recompute the document embeddings and save them as a pickle file for future use.
|
| 14 |
-
|
| 15 |
-
# from embedding_generation import compute_doc_embeddings # Import function to generate embeddings
|
| 16 |
-
# from file_utils import save_embeddings # Import function to save embeddings as a pickle file
|
| 17 |
-
|
| 18 |
-
# # Compute embeddings for the updated database (DataFrame 'df')
|
| 19 |
-
# database_embeddings = compute_doc_embeddings(df)
|
| 20 |
-
|
| 21 |
-
# # Save the newly computed embeddings to a file
|
| 22 |
-
# save_embeddings(database_embeddings, embeddings_filepath)
|
| 23 |
|
| 24 |
def chatbot(input):
|
| 25 |
try:
|
|
|
|
| 1 |
import pickle
|
| 2 |
import gradio as gr
|
| 3 |
from chatbot import answer_query_with_context
|
| 4 |
+
from file_utils import load_database, load_embeddings
|
| 5 |
|
| 6 |
database_filepath = 'services-links.csv'
|
| 7 |
embeddings_filepath = 'document_embeddings.pkl'
|
| 8 |
|
| 9 |
+
database = load_database(database_filepath)
|
| 10 |
+
database_embeddings = load_embeddings(database, database_filepath, embeddings_filepath)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def chatbot(input):
|
| 13 |
try:
|