Spaces:
Running
Running
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" | |