gpt2-general / app.py
azaninello's picture
Create app.py
be63c93
raw
history blame
483 Bytes
import gradio as gr
import transformers
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
shroom_generator = pipeline("text-generation", model=AutoModelForCausalLM.from_pretrained('LorenzoDeMattei/GePpeTto'), tokenizer="gpt2")
def generator(inizia_la_storia = ''):
shroom_result = shroom_generator(inizia_la_storia, max_length=420)
return shroom_result[0]["generated_text"]
iface = gr.Interface(fn=generator, inputs="text", outputs="text")
iface.launch()