safwansajad commited on
Commit
65f2296
·
verified ·
1 Parent(s): 851d5cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,11 +1,15 @@
 
1
  from transformers import pipeline
2
 
3
- # Use a more specific conversational model, like DialoGPT
4
  chatbot = pipeline("text-generation", model="microsoft/DialoGPT-medium")
5
 
6
  def chat(input_text):
7
  response = chatbot(input_text, max_length=50, num_return_sequences=1)
8
  return response[0]['generated_text']
9
 
10
- # Test the function with an example input
11
- print(chat("How are you feeling today?"))
 
 
 
 
1
+ import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Use the text generation pipeline with DialoGPT-medium
5
  chatbot = pipeline("text-generation", model="microsoft/DialoGPT-medium")
6
 
7
  def chat(input_text):
8
  response = chatbot(input_text, max_length=50, num_return_sequences=1)
9
  return response[0]['generated_text']
10
 
11
+ # Gradio Interface setup
12
+ interface = gr.Interface(fn=chat, inputs="text", outputs="text")
13
+
14
+ # Launch the interface
15
+ interface.launch()