Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ with gr.Blocks() as demo:
|
|
9 |
chatbot = gr.Chatbot()
|
10 |
msg = gr.Textbox()
|
11 |
clear = gr.Button("Clear")
|
12 |
-
feedback = gr.Radio(["π", "π"],
|
13 |
|
14 |
history = []
|
15 |
|
@@ -24,24 +24,15 @@ with gr.Blocks() as demo:
|
|
24 |
topic = t
|
25 |
break
|
26 |
|
27 |
-
# Check if the user is asking for a blog
|
28 |
-
if "blog" in user_message.lower():
|
29 |
-
blog_text = generate_ai_blog()
|
30 |
-
# Append the blog output to the chat history
|
31 |
-
return blog_text, [user_message, blog_text]
|
32 |
# Respond based on the detected topic
|
33 |
-
|
34 |
return "Sure, let's talk about finance!", [user_message, None]
|
35 |
elif topic == "music":
|
36 |
return "Music is wonderful! What's your favorite artist or band?", [user_message, None]
|
37 |
elif topic == "sports":
|
38 |
return "Sports are exciting! What's your favorite sport?", [user_message, None]
|
39 |
elif topic == "technology":
|
40 |
-
|
41 |
-
blog_text = generate_ai_blog()
|
42 |
-
return blog_text, [user_message, blog_text]
|
43 |
-
else:
|
44 |
-
return "Technology is fascinating! Any specific tech topic you're interested in?", [user_message, None]
|
45 |
elif topic == "health care":
|
46 |
return "Health is important! What health-related topic would you like to discuss?", [user_message, None]
|
47 |
else:
|
|
|
9 |
chatbot = gr.Chatbot()
|
10 |
msg = gr.Textbox()
|
11 |
clear = gr.Button("Clear")
|
12 |
+
feedback = gr.Radio(["π", "π"], label="Feedback")
|
13 |
|
14 |
history = []
|
15 |
|
|
|
24 |
topic = t
|
25 |
break
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
# Respond based on the detected topic
|
28 |
+
if topic == "finance":
|
29 |
return "Sure, let's talk about finance!", [user_message, None]
|
30 |
elif topic == "music":
|
31 |
return "Music is wonderful! What's your favorite artist or band?", [user_message, None]
|
32 |
elif topic == "sports":
|
33 |
return "Sports are exciting! What's your favorite sport?", [user_message, None]
|
34 |
elif topic == "technology":
|
35 |
+
return "Technology is fascinating! Any specific tech topic you're interested in?", [user_message, None]
|
|
|
|
|
|
|
|
|
36 |
elif topic == "health care":
|
37 |
return "Health is important! What health-related topic would you like to discuss?", [user_message, None]
|
38 |
else:
|