Spaces:
Sleeping
Sleeping
Commit
·
1bc2625
1
Parent(s):
2f1eb40
Create main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
API_URL = "https://api-inference.huggingface.co/models/facebook/nllb-200-3.3B"
|
| 4 |
+
HF_TOKEN = "hf_your_token_here"
|
| 5 |
+
|
| 6 |
+
headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 7 |
+
payload = {
|
| 8 |
+
"inputs": ">>afr_Latn<< Hello, how are you?",
|
| 9 |
+
"options": {"wait_for_model": True},
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
res = requests.post(API_URL, headers=headers, json=payload)
|
| 13 |
+
print(res.status_code)
|
| 14 |
+
print(res.text)
|