Bushra346 commited on
Commit
635b42b
·
verified ·
1 Parent(s): 63d07b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,18 +1,17 @@
1
  # app.py
2
 
3
  import gradio as gr
4
- from transformers import pipeline, Conversational
5
 
6
- # Load a conversational pipeline
7
  generator = pipeline("conversational", model="microsoft/DialoGPT-medium")
8
 
9
  # Define chatbot function
10
  def chat_with_bot(user_input):
11
- conversation = Conversational(user_input)
12
- response = generator(conversation)
13
- return response.generated_responses[-1]
14
 
15
- # Create Gradio interface
16
  iface = gr.Interface(
17
  fn=chat_with_bot,
18
  inputs=gr.Textbox(lines=2, placeholder="Ask me anything about study tips, university selection, scholarships, or motivation!"),
@@ -25,3 +24,4 @@ iface = gr.Interface(
25
  # Run the app
26
  if __name__ == "__main__":
27
  iface.launch()
 
 
1
  # app.py
2
 
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!"),
 
24
  # Run the app
25
  if __name__ == "__main__":
26
  iface.launch()
27
+