Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,15 @@
|
|
|
|
1 |
from transformers import pipeline
|
2 |
|
3 |
-
# Use
|
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 |
-
#
|
11 |
-
|
|
|
|
|
|
|
|
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()
|