0xAnders commited on
Commit
c1a3be6
·
1 Parent(s): 4c12b21

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install gradio transformers
2
+
3
+ import gradio as gr
4
+ from transformers import pipeline
5
+
6
+ generator = pipeline('text-generation', model='gpt2')
7
+
8
+ def generate_text(inp):
9
+ return generator(inp, max_length=50, do_sample=True, temperature=0.7)[0]['generated_text']
10
+
11
+ iface = gr.Interface(fn=generate_text, inputs="textbox", outputs="text")
12
+ iface.launch()