njvdnbus commited on
Commit
807a43a
1 Parent(s): 37cdd83

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ metrics:
5
+ - rouge
6
+ ---
7
+ # Personalised opener
8
+ This model creates an opener based on a provided interest.
9
+ ### Model input
10
+ > [INTEREST]
11
+ ### Example
12
+ > dancing
13
+
14
+ ### Output
15
+ > What's your favorite dance move to make people laugh or cry?
16
+
17
+ ### How to use in code
18
+ ```{python}
19
+ import nltk
20
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
21
+ tokenizer = AutoTokenizer.from_pretrained("njvdnbus/personalised_opener-t5-large")
22
+ model = AutoModelForSeq2SeqLM.from_pretrained("njvdnbus/personalised_opener-t5-large")
23
+
24
+ def use_model(text):
25
+ inputs = ["" + text]
26
+ inputs = tokenizer(inputs, truncation=True, return_tensors="pt")
27
+ output = model.generate(**inputs, num_beams=1, do_sample=True, min_length=10, max_length=256)
28
+ decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
29
+ predicted_interests = nltk.sent_tokenize(decoded_output.strip())[0]
30
+ return predicted_interests
31
+
32
+ text= "tennis"
33
+ print(use_model(text))
34
+ ```
35
+
36
+ > Do you think tennis is the most exciting sport out there?