Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,8 +57,8 @@ segments = load_and_preprocess_text(filename)
|
|
57 |
|
58 |
def find_relevant_segment(user_query, segments):
|
59 |
"""
|
60 |
-
|
61 |
-
|
62 |
"""
|
63 |
try:
|
64 |
# Lowercase the query for better matching
|
@@ -82,7 +82,7 @@ def find_relevant_segment(user_query, segments):
|
|
82 |
|
83 |
def generate_response(user_query, relevant_segment):
|
84 |
"""
|
85 |
-
|
86 |
"""
|
87 |
try:
|
88 |
system_message = "You are a chatbot specialized in providing information on local events, pro-Palestine movements, and community outreach, pride movements/events and community resources."
|
@@ -107,7 +107,7 @@ def generate_response(user_query, relevant_segment):
|
|
107 |
|
108 |
def query_model(question):
|
109 |
"""
|
110 |
-
|
111 |
"""
|
112 |
if question == "":
|
113 |
return "Welcome to GloBot! Ask me anything about the St. Louis Community!"
|
|
|
57 |
|
58 |
def find_relevant_segment(user_query, segments):
|
59 |
"""
|
60 |
+
Find the most relevant text segment for a user's query using cosine similarity among sentence embeddings.
|
61 |
+
This version finds the best match based on the content of the query.
|
62 |
"""
|
63 |
try:
|
64 |
# Lowercase the query for better matching
|
|
|
82 |
|
83 |
def generate_response(user_query, relevant_segment):
|
84 |
"""
|
85 |
+
Generate a response emphasizing the bot's capability in providing information about St. Louis events.
|
86 |
"""
|
87 |
try:
|
88 |
system_message = "You are a chatbot specialized in providing information on local events, pro-Palestine movements, and community outreach, pride movements/events and community resources."
|
|
|
107 |
|
108 |
def query_model(question):
|
109 |
"""
|
110 |
+
Process a question, find relevant information, and generate a response.
|
111 |
"""
|
112 |
if question == "":
|
113 |
return "Welcome to GloBot! Ask me anything about the St. Louis Community!"
|