Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
dialogpt = pipeline("text-generation", model="microsoft/DialoGPT-medium")
|
5 |
+
|
6 |
+
def respond(context):
|
7 |
+
response = dialogpt(context, max_length=100, do_sample=True)
|
8 |
+
return response[0]['generated_text'][len(context):]
|
9 |
+
|
10 |
+
iface = gr.Interface(fn=respond, inputs="text", outputs="text")
|
11 |
+
iface.launch()
|