Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import time | |
| import Content as con | |
| # Function to handle the chat response (without generator-based typing effect for simplicity) | |
| def random_response(message, history): | |
| answer = con.starting(message.lower()) # Get response from Content.py | |
| history.append((message, answer)) # Append user message and bot's answer to history | |
| return history | |
| # Create the Gradio Chatbot interface | |
| with gr.Blocks() as demo: | |
| gr.Markdown("<h1>Prakriti Analyzer</h1><p>This bot helps you understand your body constitution using Ayurveda principles.</p>") | |
| chatbot = gr.Chatbot() # Chatbot component to display conversation | |
| msg = gr.Textbox(placeholder="Enter your message here...") # Input textbox | |
| submit = gr.Button("Send") # Button to submit the message | |
| # Link the submit button to the random_response function | |
| submit.click(random_response, inputs=[msg, chatbot], outputs=chatbot) | |
| # Launch the interface | |
| demo.launch(inbrowser=True) | |