Downloads · 30 days
4
13% of all-time downloads
njvdnbus/personalised_opener-t5-large
personalised_opener-t5-large is a machine learning model from njvdnbus. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This model creates an opener based on a provided interest. [INTEREST] dancing
Downloads · 30 days
4
13% of all-time downloads
All-time downloads
32
Public
Repo size
5.9 GB
Likes
0
Public
Click a slice to open those files.
.bin3 GB · 100%
From the Hugging Face model README
This model creates an opener based on a provided interest.
[INTEREST]
dancing
What's your favorite dance move to make people laugh or cry?
import nltk
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("njvdnbus/personalised_opener-t5-large")
model = AutoModelForSeq2SeqLM.from_pretrained("njvdnbus/personalised_opener-t5-large")
def use_model(text):
inputs = ["" + text]
inputs = tokenizer(inputs, truncation=True, return_tensors="pt")
output = model.generate(**inputs, num_beams=1, do_sample=True, min_length=10, max_length=256)
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
predicted_interests = nltk.sent_tokenize(decoded_output.strip())[0]
return predicted_interests
text= "tennis"
print(use_model(text))
Do you think tennis is the most exciting sport out there?