Spaces:
Running
Running
File size: 642 Bytes
759966c a9b5bbd 759966c a9b5bbd 759966c a9b5bbd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import os
HF_API_KEY = os.getenv("HF_API_KEY") # 從環境變數讀取 API Key
if not HF_API_KEY:
raise ValueError("❌ API Key 未設定,請在 Hugging Face Spaces `Secrets` 中設置 `HF_API_KEY`")
HEADERS = {"Authorization": f"Bearer {HF_API_KEY}"}
MODEL_OPTIONS = {
"🌎 多語言推特情緒分析 (XLM-RoBERTa)": "cardiffnlp/twitter-xlm-roberta-base-sentiment",
"📖 多語言情緒分析 (BERT)": "nlptown/bert-base-multilingual-uncased-sentiment",
"🇬🇧 英語情緒分析 (DistilBERT)": "distilbert-base-uncased-finetuned-sst-2-english"
}
DEFAULT_MODEL = "cardiffnlp/twitter-xlm-roberta-base-sentiment"
|