File size: 765 Bytes
d22e86e
 
 
635b42b
d22e86e
746bade
 
d22e86e
746bade
d22e86e
746bade
635b42b
d22e86e
635b42b
d22e86e
 
746bade
d22e86e
 
746bade
d22e86e
 
 
 
 
635b42b
746bade
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
# 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()