Spaces:
Sleeping
Sleeping
fxing bug and limit response
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ cur.execute("""
|
|
35 |
""")
|
36 |
|
37 |
|
38 |
-
data = pd.read_csv('tourism_place.csv')
|
39 |
|
40 |
|
41 |
# check if the table is empty
|
@@ -116,7 +116,6 @@ def get_user_embedding(query):
|
|
116 |
# Find similar places based on cosine similarity
|
117 |
def get_similar_places(user_embedding):
|
118 |
similarities = []
|
119 |
-
|
120 |
# Select all places from the database
|
121 |
res = cur.execute("SELECT * FROM places").fetchall()
|
122 |
|
@@ -197,7 +196,11 @@ def chatbot(user_query):
|
|
197 |
return top_places
|
198 |
|
199 |
# Step 2: Generate the chatbot's response
|
200 |
-
response = generate_response(user_query, top_places)
|
|
|
|
|
|
|
|
|
201 |
return response
|
202 |
|
203 |
# Define Gradio Interface
|
|
|
35 |
""")
|
36 |
|
37 |
|
38 |
+
data = pd.read_csv('dataset/tourism_place.csv')
|
39 |
|
40 |
|
41 |
# check if the table is empty
|
|
|
116 |
# Find similar places based on cosine similarity
|
117 |
def get_similar_places(user_embedding):
|
118 |
similarities = []
|
|
|
119 |
# Select all places from the database
|
120 |
res = cur.execute("SELECT * FROM places").fetchall()
|
121 |
|
|
|
196 |
return top_places
|
197 |
|
198 |
# Step 2: Generate the chatbot's response
|
199 |
+
# response = generate_response(user_query, top_places)
|
200 |
+
|
201 |
+
# only the first 5 element of top_places
|
202 |
+
response = generate_response(user_query, top_places[:10])
|
203 |
+
|
204 |
return response
|
205 |
|
206 |
# Define Gradio Interface
|