import gradio as gr from transformers import pipeline from transformers import pipeline import re from utils import grammatical_cleaning dante = pipeline('text-generation',model='.', tokenizer='GroNLP/gpt2-small-italian-embeddings') def get_text(input): generated = dante(input, max_length=128)[0]['generated_text'] generated = grammatical_cleaning(generated) return generated iface = gr.Interface(fn=get_text, inputs="text", outputs="text") iface.launch()