try / app.py
asiaao's picture
Update app.py
16d3622 verified
import gradio as gr
from chatbot_schedule import schedule_bot_response
from chatbot_wellness import wellness_bot_response
# Define interfaces for each chatbot
def task_schedule_interface(user_input):
return schedule_bot_response(user_input)
def wellness_chatbot_interface(user_id, user_input):
return wellness_bot_response(user_id, user_input)
# Create Gradio interfaces
task_bot = gr.Interface(
fn=task_schedule_interface,
inputs=gr.Textbox(label="Describe your task and time (e.g., Schedule meeting for tomorrow at 6PM)"),
outputs="text",
title="Task Scheduler Chatbot",
description="Helps you schedule tasks into your Google Calendar."
)
wellness_bot = gr.Interface(
fn=wellness_chatbot_interface,
inputs=[
gr.Textbox(label="Enter your unique user ID (e.g., email, username)"),
gr.Textbox(label="What would you like to discuss?"),
],
outputs="text",
title="Mental Wellness Chatbot",
description="Supports your mental wellness with tailored motivational advice."
)
# Combine into a tabbed interface using Tabs
with gr.Blocks() as app:
with gr.Tabs():
with gr.TabItem("Task Scheduler"):
task_bot.render()
with gr.TabItem("Mental Wellness Support"):
wellness_bot.render()
# Launch the app
if __name__ == "__main__":
app.launch(server_port=7861)