Spaces:
Paused
Paused
delta-neuron commited on
Commit ·
c4f6bc5
1
Parent(s): 2543960
v3.1: use BRIDGE_TOKEN for bridge access
Browse files
app.py
CHANGED
|
@@ -13,7 +13,8 @@ from threading import Thread, Lock
|
|
| 13 |
|
| 14 |
HF_TOKEN = os.environ.get("HF_TOKEN", "")
|
| 15 |
BRIDGE_REPO = "Melofhell00/claude-bridge"
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
MODELS = [
|
| 19 |
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
@@ -67,7 +68,7 @@ def log(msg):
|
|
| 67 |
def call(model, messages, max_t=400, temp=0.85):
|
| 68 |
try:
|
| 69 |
r = requests.post("https://router.huggingface.co/v1/chat/completions",
|
| 70 |
-
headers={"Authorization": f"Bearer {
|
| 71 |
json={"model": model, "messages": messages, "max_tokens": max_t, "temperature": temp}, timeout=180)
|
| 72 |
return r.json()["choices"][0]["message"]["content"].strip() if r.status_code == 200 else f"[{r.status_code}]"
|
| 73 |
except Exception as e: return f"[{e}]"
|
|
|
|
| 13 |
|
| 14 |
HF_TOKEN = os.environ.get("HF_TOKEN", "")
|
| 15 |
BRIDGE_REPO = "Melofhell00/claude-bridge"
|
| 16 |
+
BRIDGE_TOKEN = os.environ.get("BRIDGE_TOKEN", HF_TOKEN)
|
| 17 |
+
BRIDGE_URL = f"https://Melofhell00:{BRIDGE_TOKEN}@huggingface.co/datasets/{BRIDGE_REPO}"
|
| 18 |
|
| 19 |
MODELS = [
|
| 20 |
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
|
|
| 68 |
def call(model, messages, max_t=400, temp=0.85):
|
| 69 |
try:
|
| 70 |
r = requests.post("https://router.huggingface.co/v1/chat/completions",
|
| 71 |
+
headers={"Authorization": f"Bearer {BRIDGE_TOKEN}", "Content-Type": "application/json"},
|
| 72 |
json={"model": model, "messages": messages, "max_tokens": max_t, "temperature": temp}, timeout=180)
|
| 73 |
return r.json()["choices"][0]["message"]["content"].strip() if r.status_code == 200 else f"[{r.status_code}]"
|
| 74 |
except Exception as e: return f"[{e}]"
|