Spaces:
Sleeping
Sleeping
Updates.py
Browse files
app.py
CHANGED
@@ -70,27 +70,36 @@ rag_chain = (
|
|
70 |
|
71 |
import gradio as gr
|
72 |
|
73 |
-
|
|
|
74 |
partial_text = ""
|
75 |
-
for new_text in rag_chain.stream(
|
76 |
partial_text += new_text
|
77 |
yield partial_text
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
title=title,
|
87 |
-
|
88 |
-
|
89 |
-
outputs="text",
|
90 |
examples=examples,
|
91 |
-
|
92 |
)
|
93 |
|
94 |
-
|
95 |
if __name__ == "__main__":
|
96 |
demo.launch()
|
|
|
|
70 |
|
71 |
import gradio as gr
|
72 |
|
73 |
+
# Function to handle chat input and generate responses using rag_chain
|
74 |
+
def animepedia_memory_stream(message, history):
|
75 |
partial_text = ""
|
76 |
+
for new_text in rag_chain.stream(message): # Assuming rag_chain is configured for Animepedia
|
77 |
partial_text += new_text
|
78 |
yield partial_text
|
79 |
|
80 |
+
# Examples of user queries for Animepedia
|
81 |
+
examples = [
|
82 |
+
"What is the highest-rated action anime?",
|
83 |
+
"Can you recommend an anime with less than 12 episodes?",
|
84 |
+
"Tell me about a family-friendly anime.",
|
85 |
+
]
|
86 |
+
|
87 |
+
# Description and title for the Animepedia chatbot
|
88 |
+
description = "Real-time Anime Companion to Answer Questions and Provide Recommendations About Your Favorite Shows."
|
89 |
+
title = "Animepedia: Your Ultimate Anime Guide"
|
90 |
+
|
91 |
+
# Creating the Gradio Chat Interface
|
92 |
+
demo = gr.ChatInterface(
|
93 |
+
fn=animepedia_memory_stream,
|
94 |
+
type="messages",
|
95 |
title=title,
|
96 |
+
description=description,
|
97 |
+
fill_height=True,
|
|
|
98 |
examples=examples,
|
99 |
+
theme="glass",
|
100 |
)
|
101 |
|
102 |
+
# Launching the chatbot interface
|
103 |
if __name__ == "__main__":
|
104 |
demo.launch()
|
105 |
+
|