Update app.py
Browse files
app.py
CHANGED
|
@@ -4,11 +4,11 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
| 4 |
import nltk
|
| 5 |
nltk.download('punkt_tab')
|
| 6 |
|
| 7 |
-
|
| 8 |
kw_model = KeyBERT()
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained("itskavya/t5-small-finetuned-titlegen2") # this is where the model is saved on hf, can load it n use it
|
| 10 |
model = AutoModelForSeq2SeqLM.from_pretrained("itskavya/t5-small-finetuned-titlegen2")
|
| 11 |
-
|
| 12 |
max_input_length=512
|
| 13 |
|
| 14 |
def predict(text):
|
|
|
|
| 4 |
import nltk
|
| 5 |
nltk.download('punkt_tab')
|
| 6 |
|
| 7 |
+
device="cpu"
|
| 8 |
kw_model = KeyBERT()
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained("itskavya/t5-small-finetuned-titlegen2") # this is where the model is saved on hf, can load it n use it
|
| 10 |
model = AutoModelForSeq2SeqLM.from_pretrained("itskavya/t5-small-finetuned-titlegen2")
|
| 11 |
+
model.to(device)
|
| 12 |
max_input_length=512
|
| 13 |
|
| 14 |
def predict(text):
|