Jaglinux commited on
Commit
0b2d9d7
·
verified ·
1 Parent(s): 66b20fc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ def infer(input_text):
5
+ out = pipeline("text-generation", model="gpt2")
6
+ output_text = out(input_text, max_length=30, num_return_sequences=1)
7
+ return output_text[0]['generated_text']
8
+
9
+ demo = gr.Interface(
10
+ fn=infer,
11
+ inputs=["text"],
12
+ outputs=["text"],
13
+ )
14
+
15
+ demo.launch()