mohd43 commited on
Commit
72ffc90
·
verified ·
1 Parent(s): e3add5c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("text-generation", model="gpt2")
5
+
6
+ # a function that uses the pipeline
7
+ # takes text as input and passes it to the pipeline
8
+ def chat(text):
9
+ output = pipe(text)[0]["generated_text"]
10
+ return output
11
+ # fucntion , input of type text , output of type text
12
+ demo = gr.Interface(chat , "text" , "text" )
13
+ demo.launch()