import gradio as gr from transformers import T5Tokenizer, T5ForConditionalGeneration tokenizer = T5Tokenizer.from_pretrained("./model_files") model = T5ForConditionalGeneration.from_pretrained("./model_files") def greet(name): inp = "Summarize:" + name input_ids = tokenizer(inp, return_tensors="pt").input_ids #return tokenizer.decode(outputs[0],skip_special_tokens=True, clean_up_tokenization_spaces=True) return inp # We instantiate the Textbox class textbox = gr.Textbox(label="Type your name here:", placeholder="Article", lines=5) gr.Interface(fn=greet, inputs=textbox, outputs="text").launch()