File size: 1,419 Bytes
e757d5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# # app.py

# import gradio as gr
# from pipeline import chatbot_response, generate_coherent_response, ChatHistory

# # Create a new instance of chat history
# chat_history = ChatHistory()

# # Step 6: Define Gradio Interface for Chatbot
# def gradio_chatbot(user_query):
#     # Step 7: Retrieve relevant data for the query
#     retrieved_data = chatbot_response(user_query)

#     # Step 8: Check and verify the query for health/wellness content
#     is_valid = True
#     if is_valid:
#         # Generate a coherent response using Groq's DeepSeek-R1 LLM
#         coherent_response = generate_coherent_response(user_query, retrieved_data, chat_history.get_history())
#     else:
#         coherent_response = "The query does not seem to match health and wellness topics."

#     # Add the user message and assistant response to the chat history
#     chat_history.add_message("user", user_query)
#     chat_history.add_message("assistant", coherent_response)

#     # Return the response and the chat history
#     return coherent_response, chat_history.get_history()

# # Create the Gradio interface
# iface = gr.Interface(fn=gradio_chatbot,
#                      inputs=gr.Textbox(label="Ask a question"),
#                      outputs=[gr.Textbox(label="Chatbot Response"), gr.Textbox(label="Chat History")],
#                      title="Wellness Chatbot")

# # Launch the Gradio interface
# iface.launch()