Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -191,7 +191,6 @@ previous_response = ""
|
|
| 191 |
|
| 192 |
|
| 193 |
def get_response(query):
|
| 194 |
-
global previous_query, previous_response
|
| 195 |
|
| 196 |
if previous_response.lower() == "Sure! To assist you better, please provide the name or code of the course you are referring to, along with the complete query.":
|
| 197 |
# Append the previous query to the current one
|
|
@@ -216,18 +215,17 @@ def get_response(query):
|
|
| 216 |
|
| 217 |
return response
|
| 218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
iface = gr.Interface(
|
| 220 |
-
fn=
|
| 221 |
inputs=[gr.Textbox(label="User:", placeholder="Enter your query")],
|
| 222 |
outputs=[gr.Textbox(label="Anjibot:", lines=3)],
|
| 223 |
title="AnjBot",
|
| 224 |
description="Hello! I'm AnjiBot, CS Group A AI Course Rep. How may I assist you today?",
|
| 225 |
-
examples=[
|
| 226 |
-
["I need Dr. Seun's phone number"],
|
| 227 |
-
["When is the next class?"],
|
| 228 |
-
["I need the slides from today's lectures."],
|
| 229 |
-
],
|
| 230 |
-
additional_inputs=[
|
| 231 |
-
gr.Textbox(value="Please note that the data you share with Anjibot is not private.")]
|
| 232 |
)
|
| 233 |
-
iface.launch(
|
|
|
|
| 191 |
|
| 192 |
|
| 193 |
def get_response(query):
|
|
|
|
| 194 |
|
| 195 |
if previous_response.lower() == "Sure! To assist you better, please provide the name or code of the course you are referring to, along with the complete query.":
|
| 196 |
# Append the previous query to the current one
|
|
|
|
| 215 |
|
| 216 |
return response
|
| 217 |
|
| 218 |
+
# Function to handle Gradio interface
|
| 219 |
+
def chatty(query):
|
| 220 |
+
response = get_response(query)
|
| 221 |
+
return response
|
| 222 |
+
|
| 223 |
iface = gr.Interface(
|
| 224 |
+
fn=chatty,
|
| 225 |
inputs=[gr.Textbox(label="User:", placeholder="Enter your query")],
|
| 226 |
outputs=[gr.Textbox(label="Anjibot:", lines=3)],
|
| 227 |
title="AnjBot",
|
| 228 |
description="Hello! I'm AnjiBot, CS Group A AI Course Rep. How may I assist you today?",
|
| 229 |
+
examples=["I need Dr. Seun's phone number", "When is the next class?", "I need the slides from today's lectures."]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
)
|
| 231 |
+
iface.launch()
|