studychatbot / chatbot_ui.py
MissieMcCown's picture
Upload chatbot_ui.py
69f9ac0 verified
raw
history blame
1.01 kB
import gradio as gr
def chatbot_response(user_input):
if user_input.lower() in ["hello", "hi"]:
return "Hello! How can I help you with your studies today?"
elif "supervised learning" in user_input.lower():
return "Supervised learning is a machine learning approach where models are trained using labeled data."
else:
return "I'm here to assist you with your academic questions. Please ask me anything!"
with gr.Blocks() as demo:
gr.Markdown("# Study Assistance Chatbot")
gr.Markdown("Welcome! Ask me anything related to your academic studies.")
with gr.Row():
with gr.Column():
user_input = gr.Textbox(label="Enter your question here:")
submit_button = gr.Button("Submit")
with gr.Column():
chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False)
submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot_output)
demo.launch()