Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,11 +60,11 @@ def find_relevant_segment(user_query, segments):
|
|
60 |
|
61 |
def generate_response(user_query, relevant_segment):
|
62 |
"""
|
63 |
-
Generate a response emphasizing the bot's capability in providing
|
64 |
"""
|
65 |
try:
|
66 |
-
system_message = "You are a
|
67 |
-
user_message = f"Here's the information on
|
68 |
messages = [
|
69 |
{"role": "system", "content": system_message},
|
70 |
{"role": "user", "content": user_message}
|
@@ -88,7 +88,7 @@ def query_model(question):
|
|
88 |
Process a question, find relevant information, and generate a response.
|
89 |
"""
|
90 |
if question == "":
|
91 |
-
return "Welcome to
|
92 |
relevant_segment = find_relevant_segment(question, segments)
|
93 |
if not relevant_segment:
|
94 |
return "Could not find specific information. Please refine your question."
|
@@ -97,20 +97,20 @@ def query_model(question):
|
|
97 |
|
98 |
# Define the welcome message and specific topics the chatbot can provide information about
|
99 |
welcome_message = """
|
100 |
-
#
|
101 |
|
102 |
-
## Your AI-driven assistant for all
|
103 |
"""
|
104 |
|
105 |
topics = """
|
106 |
### Feel Free to ask me anything from the topics below!
|
107 |
-
-
|
108 |
-
-
|
109 |
-
-
|
110 |
-
-
|
111 |
-
-
|
112 |
-
-
|
113 |
-
-
|
114 |
"""
|
115 |
|
116 |
# Setup the Gradio Blocks interface with custom layout components
|
@@ -122,7 +122,7 @@ with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
|
122 |
with gr.Row():
|
123 |
with gr.Column():
|
124 |
question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
|
125 |
-
answer = gr.Textbox(label="
|
126 |
submit_button = gr.Button("Submit")
|
127 |
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
128 |
|
|
|
60 |
|
61 |
def generate_response(user_query, relevant_segment):
|
62 |
"""
|
63 |
+
Generate a response emphasizing the bot's capability in providing information about St. Louis events.
|
64 |
"""
|
65 |
try:
|
66 |
+
system_message = "You are a News chatbot specialized in providing information on local news, local events and community resources."
|
67 |
+
user_message = f"Here's the information on St. Louis Events: {relevant_segment}"
|
68 |
messages = [
|
69 |
{"role": "system", "content": system_message},
|
70 |
{"role": "user", "content": user_message}
|
|
|
88 |
Process a question, find relevant information, and generate a response.
|
89 |
"""
|
90 |
if question == "":
|
91 |
+
return "Welcome to GloBot! Ask me anything about the St. Louis Community!"
|
92 |
relevant_segment = find_relevant_segment(question, segments)
|
93 |
if not relevant_segment:
|
94 |
return "Could not find specific information. Please refine your question."
|
|
|
97 |
|
98 |
# Define the welcome message and specific topics the chatbot can provide information about
|
99 |
welcome_message = """
|
100 |
+
# 🌎 Welcome to GloBot!
|
101 |
|
102 |
+
## Your AI-driven assistant for all St.Louis-related queries. Created by Honna, Davonne, and Maryam of the 2024 Kode With Klossy CITY Camp.
|
103 |
"""
|
104 |
|
105 |
topics = """
|
106 |
### Feel Free to ask me anything from the topics below!
|
107 |
+
- Pro-Palenstine Events
|
108 |
+
- Pride Events
|
109 |
+
- Social Justice Workshops
|
110 |
+
- Cultural Festivals
|
111 |
+
- Community Outreach Programs
|
112 |
+
- Enviormental Activism
|
113 |
+
- Health & Wellness Events
|
114 |
"""
|
115 |
|
116 |
# Setup the Gradio Blocks interface with custom layout components
|
|
|
122 |
with gr.Row():
|
123 |
with gr.Column():
|
124 |
question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
|
125 |
+
answer = gr.Textbox(label="GloBot Response", placeholder="GloBot will respond here...", interactive=False, lines=10)
|
126 |
submit_button = gr.Button("Submit")
|
127 |
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
128 |
|