What is T5? Text-To-Text Transfer Transformer (T5) from Google gives the power of translation.
In the article, we will deploy Google T5 model as a REST API service. Difficult? What about I’ll tell you: you just need to write 7 lines of codes?
**HuggingFace** makes it easy to use the pretrained model with just several lines.
**Pinferencia** makes it super easy to serve any model with just three extra lines.
pip install "transformers[pytorch]"
If it doesn’t work, please visit Installation (huggingface.co) and check their official documentations.
pip install "pinferencia[uvicorn]"
If it doesn’t work, please visit Install — Pinferencia (underneathall.app) and check their official documentations.
First let’s create the app.py to define the service:
uvicorn app:service --reload
Wait for the model get downloaded. When it’s finished, you’ll see:
You can use curl or the interactive api page from Pinferencia.