Spaces:
Sleeping
Sleeping
File size: 1,080 Bytes
a96fdb7 b09c682 3fd078e 593f7f6 133d9fc b09c682 133d9fc b09c682 593f7f6 a96fdb7 593f7f6 a96fdb7 593f7f6 ac5a27a 593f7f6 a96fdb7 21f053b |
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 |
import gradio as gr # For building the chatbot UI
# Chatbot response function
def chatbot_response(user_input):
if user_input.lower() in ["hello", "hi"]:
response = "Hello! How can I help you with your studies today?"
else:
response = "I'm here to assist with academic questions. Feel free to ask about study tips, time management, or anything else!"
# Returning the conversation in the correct format (list of tuples)
return [(user_input, response)]
# Gradio interface setup
with gr.Blocks() as demo:
gr.Markdown("# Study Assistance Chatbot")
gr.Markdown("Ask me anything related to your academic studies.")
chatbot = gr.Chatbot() # Chat history UI
user_input = gr.Textbox(label="Enter your question here:", placeholder="Type your question...") # Textbox for user input
submit_button = gr.Button("Submit") # Submit button for user input
# Submit action - to update chat with response
submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot)
# Launch the Gradio app
demo.launch()
|