Create app.py
Browse files
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()
|