Thebull commited on
Commit
85e8469
·
verified ·
1 Parent(s): 7df0579

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
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()