Skip to content

Built and deployed Text Summarization Hugging face Model on AWS

License

Notifications You must be signed in to change notification settings

kshitijzutshi/BERT-Summary-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BERT-Summary-API

Created BERT Text Summarization API deployed on AWS ECR

Hugging Face model

Following Hugging face model was used : mrm8488/t5-base-finetuned-summarize-news 🚀

Model Description

The T5 model was presented in Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu

How to Use

To load and save the model -


from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-summarize-news")

model = AutoModelForSeq2SeqLM.from_pretrained("mrm8488/t5-base-finetuned-summarize-news")

To Invoke the model from Hugging face -


import requests

API_URL = "https://api-inference.huggingface.co/models/mrm8488/t5-base-finetuned-summarize-news"
headers = {"Authorization": f"Bearer {API_TOKEN}"}

def query(payload):
	response = requests.post(API_URL, headers=headers, json=payload)
	return response.json()

output = query({
	"inputs": "The answer to the universe is",
})

AWS deployed ECR - Lambda function

The API is deployed and REST POST call was 200 OK

image

Releases

No releases published

Packages

No packages published

Languages