SamanthaStorm commited on
Commit
96f05f0
·
verified ·
1 Parent(s): 7df97d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -29,15 +29,13 @@ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
29
  sentiment_model = AutoModelForSequenceClassification.from_pretrained("SamanthaStorm/tether-sentiment").to(device)
30
  sentiment_tokenizer = AutoTokenizer.from_pretrained("SamanthaStorm/tether-sentiment", use_fast=False)
31
 
32
- # Emotion pipeline
33
- emotion_pipeline = hf_pipeline(
34
  "text-classification",
35
  model="j-hartmann/emotion-english-distilroberta-base",
36
- top_k=6,
37
- truncation=True,
38
- device=0 if torch.cuda.is_available() else -1
39
  )
40
-
41
  # DARVO model
42
  darvo_model = AutoModelForSequenceClassification.from_pretrained("SamanthaStorm/tether-darvo-regressor-v1").to(device)
43
  darvo_tokenizer = AutoTokenizer.from_pretrained("SamanthaStorm/tether-darvo-regressor-v1", use_fast=False)
 
29
  sentiment_model = AutoModelForSequenceClassification.from_pretrained("SamanthaStorm/tether-sentiment").to(device)
30
  sentiment_tokenizer = AutoTokenizer.from_pretrained("SamanthaStorm/tether-sentiment", use_fast=False)
31
 
32
+ emotion_pipeline = pipeline(
 
33
  "text-classification",
34
  model="j-hartmann/emotion-english-distilroberta-base",
35
+ tokenizer="j-hartmann/emotion-english-distilroberta-base",
36
+ return_all_scores=True, # ← ensure we get all six scores, not just top-1
37
+ top_k=None # ensure no automatic top-k truncation (so you see all labels)
38
  )
 
39
  # DARVO model
40
  darvo_model = AutoModelForSequenceClassification.from_pretrained("SamanthaStorm/tether-darvo-regressor-v1").to(device)
41
  darvo_tokenizer = AutoTokenizer.from_pretrained("SamanthaStorm/tether-darvo-regressor-v1", use_fast=False)