File size: 976 Bytes
fc8cefd
 
2d497be
 
10ebf33
 
 
 
 
fc8cefd
10ebf33
 
 
2d497be
10ebf33
 
 
fc8cefd
10ebf33
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)