File size: 527 Bytes
be63c93
 
 
 
1bde40f
 
ca9faff
be63c93
 
a18a223
be63c93
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
import transformers
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

shroom_generator = pipeline("text-generation", model=AutoModelForCausalLM.from_pretrained('LorenzoDeMattei/GePpeTto'),
    tokenizer='LorenzoDeMattei/GePpeTto', 
    max_length=50)

def generator(inizia_la_storia = ''):
  shroom_result = shroom_generator(inizia_la_storia, max_length=120) 
  return shroom_result[0]["generated_text"]

iface = gr.Interface(fn=generator, inputs="text", outputs="text")
iface.launch()