dntwaritag commited on
Commit
8446f7a
·
verified ·
1 Parent(s): 72f6b61

Updates.py

Browse files
Files changed (1) hide show
  1. app.py +23 -14
app.py CHANGED
@@ -70,27 +70,36 @@ rag_chain = (
70
 
71
  import gradio as gr
72
 
73
- def rag_memory_stream(text):
 
74
  partial_text = ""
75
- for new_text in rag_chain.stream(text):
76
  partial_text += new_text
77
  yield partial_text
78
 
79
- examples = ["I love action movies. Can you recommend one with a high rating?"]
80
-
81
-
82
-
83
-
84
- title = "Real-time AI App with Groq API and LangChain to Answer medical questions"
85
- demo = gr.Interface(
 
 
 
 
 
 
 
 
86
  title=title,
87
- fn=rag_memory_stream,
88
- inputs="text",
89
- outputs="text",
90
  examples=examples,
91
- allow_flagging="never",
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
+