Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,18 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import pickle
|
|
|
|
| 3 |
from chatbot import answer_query_with_context
|
| 4 |
from file_utils import load_service_data, load_pickle
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def chatbot(input):
|
| 10 |
try:
|
| 11 |
if input:
|
| 12 |
-
reply = answer_query_with_context(input,
|
| 13 |
return reply
|
| 14 |
except Exception as e:
|
| 15 |
return str(e)
|
|
|
|
|
|
|
| 1 |
import pickle
|
| 2 |
+
import gradio as gr
|
| 3 |
from chatbot import answer_query_with_context
|
| 4 |
from file_utils import load_service_data, load_pickle
|
| 5 |
|
| 6 |
+
database_filepath = 'services-links.csv'
|
| 7 |
+
embeddings_filepath = 'document_embeddings.pkl'
|
| 8 |
+
|
| 9 |
+
database = load_service_data(database_filepath)
|
| 10 |
+
database_embeddings = load_pickle(embeddings_filepath)
|
| 11 |
|
| 12 |
def chatbot(input):
|
| 13 |
try:
|
| 14 |
if input:
|
| 15 |
+
reply = answer_query_with_context(input, database, database_embeddings)
|
| 16 |
return reply
|
| 17 |
except Exception as e:
|
| 18 |
return str(e)
|