Abelex commited on
Commit
183f13d
Β·
verified Β·
1 Parent(s): 2fd76cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -42,13 +42,13 @@ except Exception as e:
42
  print("⚠ Could not load config.json β€” using fallback")
43
  id2label = {
44
  0: "Politics",
45
- 1: "Business",
46
  2: "Sports",
47
  3: "Technology",
48
  4: "Health",
49
- 5: "Entertainment",
50
- 6: "World",
51
- 7: "Other",
52
  }
53
  label2id = {v: k for k, v in id2label.items()}
54
  num_labels = len(id2label)
@@ -111,10 +111,10 @@ tokenizer = AutoTokenizer.from_pretrained(PRETRAINED)
111
 
112
  model = HybridSentenceChuLo(PRETRAINED, num_labels).to(DEVICE)
113
 
114
- print("Loading trained weights...")
115
- state = torch.hub.load_state_dict_from_url(
116
- f"https://huggingface.co/{HF_MODEL_ID}/resolve/main/pytorch_model.bin",
117
- map_location=DEVICE
118
  )
119
  model.load_state_dict(state, strict=False)
120
  model.eval()
 
42
  print("⚠ Could not load config.json β€” using fallback")
43
  id2label = {
44
  0: "Politics",
45
+ 1: "Economy",
46
  2: "Sports",
47
  3: "Technology",
48
  4: "Health",
49
+ 5: "Agriculture",
50
+ 6: "accident",
51
+ 7: "education",
52
  }
53
  label2id = {v: k for k, v in id2label.items()}
54
  num_labels = len(id2label)
 
111
 
112
  model = HybridSentenceChuLo(PRETRAINED, num_labels).to(DEVICE)
113
 
114
+ from transformers import AutoModel
115
+ model = AutoModel.from_pretrained(
116
+ "Abelex/afro-xlmr-large",
117
+ trust_remote_code=True
118
  )
119
  model.load_state_dict(state, strict=False)
120
  model.eval()