EfektMotyla commited on
Commit
af2576d
·
verified ·
1 Parent(s): e69a3fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -17
app.py CHANGED
@@ -11,32 +11,21 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
11
 
12
  hf_token = os.getenv("HF_TOKEN")
13
 
14
- aspect_tokenizer = AutoTokenizer.from_pretrained(
15
- "EfektMotyla/bert-aspect-ner", token=hf_token
16
- )
17
- aspect_model = AutoModelForTokenClassification.from_pretrained(
18
- "EfektMotyla/bert-aspect-ner", token=hf_token
19
- ).to(device)
20
 
21
- sentiment_tokenizer = AutoTokenizer.from_pretrained(
22
- "EfektMotyla/absa-roberta", token=hf_token
23
- )
24
- sentiment_model = AutoModelForSequenceClassification.from_pretrained(
25
- "EfektMotyla/absa-roberta", token=hf_token
26
- ).to(device)
27
 
28
  pl_to_en = pipeline(
29
  "translation",
30
  model="Helsinki-NLP/opus-mt-pl-en",
31
- device=0 if device == "cuda" else -1,
32
- token=hf_token
33
  )
34
-
35
  en_to_pl = pipeline(
36
  "translation",
37
  model="gsarti/opus-mt-tc-en-pl",
38
- device=0 if device == "cuda" else -1,
39
- token=hf_token
40
  )
41
 
42
  # === Dane wejściowe i wyjściowe ===
 
11
 
12
  hf_token = os.getenv("HF_TOKEN")
13
 
14
+ aspect_tokenizer = AutoTokenizer.from_pretrained("EfektMotyla/bert-aspect-ner")
15
+ aspect_model = AutoModelForTokenClassification.from_pretrained("EfektMotyla/bert-aspect-ner").to(device)
 
 
 
 
16
 
17
+ sentiment_tokenizer = AutoTokenizer.from_pretrained("EfektMotyla/absa-roberta")
18
+ sentiment_model = AutoModelForSequenceClassification.from_pretrained("EfektMotyla/absa-roberta").to(device)
 
 
 
 
19
 
20
  pl_to_en = pipeline(
21
  "translation",
22
  model="Helsinki-NLP/opus-mt-pl-en",
23
+ device=0 if device == "cuda" else -1
 
24
  )
 
25
  en_to_pl = pipeline(
26
  "translation",
27
  model="gsarti/opus-mt-tc-en-pl",
28
+ device=0 if device == "cuda" else -1
 
29
  )
30
 
31
  # === Dane wejściowe i wyjściowe ===