Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,10 +23,7 @@ def init_gsheet():
|
|
| 23 |
SHEET = init_gsheet()
|
| 24 |
|
| 25 |
# === NVIDIA NIM API ===
|
| 26 |
-
api_key = os.getenv("NVIDIA_API_KEY")
|
| 27 |
-
|
| 28 |
MODEL_NAME = "nvidia/nemotron-3-ultra-550b-a55b"
|
| 29 |
-
|
| 30 |
NIM_API_URL = "https://integrate.api.nvidia.com/v1/chat/completions"
|
| 31 |
|
| 32 |
# === 評分穩定化:不改動輸入介面與 Google Sheet 儲存格式 ===
|
|
@@ -100,8 +97,10 @@ def render_score_card(total, raw):
|
|
| 100 |
|
| 101 |
# === 呼叫 API ===
|
| 102 |
def call_model(summary: str) -> str:
|
|
|
|
|
|
|
| 103 |
if not api_key:
|
| 104 |
-
return "【設定錯誤】找不到 NVIDIA_API_KEY,請檢查設定。"
|
| 105 |
|
| 106 |
normalized_summary = normalize_summary_for_scoring(summary)
|
| 107 |
cache_key = hashlib.sha256(
|
|
|
|
| 23 |
SHEET = init_gsheet()
|
| 24 |
|
| 25 |
# === NVIDIA NIM API ===
|
|
|
|
|
|
|
| 26 |
MODEL_NAME = "nvidia/nemotron-3-ultra-550b-a55b"
|
|
|
|
| 27 |
NIM_API_URL = "https://integrate.api.nvidia.com/v1/chat/completions"
|
| 28 |
|
| 29 |
# === 評分穩定化:不改動輸入介面與 Google Sheet 儲存格式 ===
|
|
|
|
| 97 |
|
| 98 |
# === 呼叫 API ===
|
| 99 |
def call_model(summary: str) -> str:
|
| 100 |
+
api_key = (os.environ.get("NVIDIA_API_KEY") or "").strip()
|
| 101 |
+
|
| 102 |
if not api_key:
|
| 103 |
+
return "【設定錯誤】找不到 NVIDIA_API_KEY,請檢查 Hugging Face Space Secrets 設定。"
|
| 104 |
|
| 105 |
normalized_summary = normalize_summary_for_scoring(summary)
|
| 106 |
cache_key = hashlib.sha256(
|