Spaces:
Sleeping
Sleeping
| # app.py | |
| import gradio as gr | |
| from transformers import pipeline | |
| # Use a text-generation model instead of conversational for simplicity | |
| generator = pipeline("text-generation", model="gpt2") | |
| # Chatbot function | |
| def chat_with_bot(user_input): | |
| response = generator(user_input, max_length=100, num_return_sequences=1) | |
| return response[0]['generated_text'] | |
| # Gradio interface | |
| iface = gr.Interface( | |
| fn=chat_with_bot, | |
| inputs=gr.Textbox(lines=2, placeholder="Ask about study tips, scholarships, university selection, motivation!"), | |
| outputs="text", | |
| title="🎓 Student Advisor Chatbot", | |
| description="Get helpful study advice, routines, university guidance, and motivation!", | |
| theme="compact" | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |