Durrani95 commited on
Commit
033188e
·
verified ·
1 Parent(s): fb29e59

Add fine-tuned EuroBERT for binary geopolitical classification

Browse files
Files changed (1) hide show
  1. README.md +4 -16
README.md CHANGED
@@ -36,14 +36,15 @@ Fine-tuned `EuroBERT/EuroBERT-210m` for **binary** classification of geopolitica
36
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
37
  import torch
38
 
39
- model_id = "durrani95/eurobert-geopolitical-binary"
40
 
41
  tokenizer = AutoTokenizer.from_pretrained(model_id)
42
  model = AutoModelForSequenceClassification.from_pretrained(model_id)
43
 
44
  texts = [
45
- "The EU imposed sanctions amid growing tensions with Russia.",
46
- "New trade agreements are boosting European exports."
 
47
  ]
48
 
49
  inputs = tokenizer(texts, padding=True, truncation=True, max_length=3200, return_tensors="pt")
@@ -59,19 +60,6 @@ for text, p in zip(texts, probs):
59
  print(f"{label:>16} {confidence:6.2%} | {text}")
60
  ```
61
 
62
- ### Inference API (no local setup)
63
-
64
- ```python
65
- from huggingface_hub import InferenceClient
66
-
67
- client = InferenceClient(model="durrani95/eurobert-geopolitical-binary") # add token=... if private
68
- res = client.text_classification("Parliament passed emergency measures amid escalating border tensions.")
69
- print(res) # [{'label': 'geopolitical', 'score': 0.99}, ...]
70
- ```
71
-
72
- ```bash
73
- curl https://api-inference.huggingface.co/models/durrani95/eurobert-geopolitical-binary -H "Authorization: Bearer $HF_TOKEN" -X POST -d '{"inputs": "Talks broke down at the UN Security Council."}'
74
- ```
75
 
76
  ---
77
 
 
36
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
37
  import torch
38
 
39
+ model_id = "Durrani95/eurobert-geopolitical-binary"
40
 
41
  tokenizer = AutoTokenizer.from_pretrained(model_id)
42
  model = AutoModelForSequenceClassification.from_pretrained(model_id)
43
 
44
  texts = [
45
+ "“Energy Sanctions Deepen Divide Between Western Bloc and Major Oil Exporters.",
46
+ "Military Exercises Near Disputed Waters Raise Fears of Regional Escalations.",
47
+
48
  ]
49
 
50
  inputs = tokenizer(texts, padding=True, truncation=True, max_length=3200, return_tensors="pt")
 
60
  print(f"{label:>16} {confidence:6.2%} | {text}")
61
  ```
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  ---
65