File size: 476 Bytes
1516e49
 
 
 
e64746a
1516e49
6f51388
1516e49
 
 
 
 
 
e64746a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()