generator / app.py
edemgold's picture
adding source code
0808a61
raw
history blame
531 Bytes
# -*- coding: utf-8 -*-
"""app.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/19167B_f_iSL9n-syr-urLCEIq5RZFmcZ
"""
!pip install gradio
!pip install transformers
from transformers import pipeline, set_seed
generator = pipeline('text-generation', model='gpt2')
import gradio as gr
def func(text):
generated = generator(text)
return generated
app = gr.Interface(fn=func, inputs="textbox", outputs="textbox", title="Text Generator")
app.launch()