T5 / app.py
akhaliq's picture
akhaliq HF Staff
Update app.py
bce1fc6
raw
history blame
724 Bytes
import os
from onnxt5 import GenerativeT5
from onnxt5.api import get_encoder_decoder_tokenizer
import gradio as gr
os.system("pip install onnxruntime==1.6.0")
decoder_sess, encoder_sess, tokenizer = get_encoder_decoder_tokenizer()
generative_t5 = GenerativeT5(encoder_sess, decoder_sess, tokenizer, onnx=True)
def inference(prompt):
output_text, output_logits = generative_t5(prompt, max_length=100, temperature=0.)
return output_text
title="T5"
description="T5 is a transformer model which aims to provide great flexibility and provide better semantic understanding through the training of multiple tasks at once."
gr.Interface(inference,"text","text",title=title,description=description).launch(enable_queue=True)