Spaces:
Running
Running
File size: 530 Bytes
4a86a4b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from transformers import pipeline
from keybert import KeyBERT
import torch
device = 0 if torch.cuda.is_available() else -1
print("Device set to:", "cuda" if device == 0 else "cpu")
summarizer = pipeline(
"summarization",
model="pszemraj/led-large-book-summary",
tokenizer="pszemraj/led-large-book-summary",
device=device
)
classifier = pipeline(
"text-classification",
model="ranudee/news-category-classifier",
tokenizer="ranudee/news-category-classifier",
device=device
)
kw_model = KeyBERT()
|