Bushra346 commited on
Commit
746bade
·
verified ·
1 Parent(s): 635b42b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -3,25 +3,25 @@
3
  import gradio as gr
4
  from transformers import pipeline
5
 
6
- # Load conversational pipeline
7
- generator = pipeline("conversational", model="microsoft/DialoGPT-medium")
8
 
9
- # Define chatbot function
10
  def chat_with_bot(user_input):
11
- response = generator(user_input)
12
  return response[0]['generated_text']
13
 
14
  # Gradio interface
15
  iface = gr.Interface(
16
  fn=chat_with_bot,
17
- inputs=gr.Textbox(lines=2, placeholder="Ask me anything about study tips, university selection, scholarships, or motivation!"),
18
  outputs="text",
19
  title="🎓 Student Advisor Chatbot",
20
- description="Get study advice, routine tips, university guidance, and motivational support.",
21
  theme="compact"
22
  )
23
 
24
- # Run the app
25
  if __name__ == "__main__":
26
  iface.launch()
27
 
 
 
3
  import gradio as gr
4
  from transformers import pipeline
5
 
6
+ # Use a text-generation model instead of conversational for simplicity
7
+ generator = pipeline("text-generation", model="gpt2")
8
 
9
+ # Chatbot function
10
  def chat_with_bot(user_input):
11
+ response = generator(user_input, max_length=100, num_return_sequences=1)
12
  return response[0]['generated_text']
13
 
14
  # Gradio interface
15
  iface = gr.Interface(
16
  fn=chat_with_bot,
17
+ inputs=gr.Textbox(lines=2, placeholder="Ask about study tips, scholarships, university selection, motivation!"),
18
  outputs="text",
19
  title="🎓 Student Advisor Chatbot",
20
+ description="Get helpful study advice, routines, university guidance, and motivation!",
21
  theme="compact"
22
  )
23
 
 
24
  if __name__ == "__main__":
25
  iface.launch()
26
 
27
+