Spaces:
Sleeping
Sleeping
Update multi_inference.py
Browse files- multi_inference.py +13 -17
multi_inference.py
CHANGED
|
@@ -1,25 +1,23 @@
|
|
| 1 |
-
# multi_inference.py
|
| 2 |
|
| 3 |
import requests
|
| 4 |
-
import os
|
| 5 |
|
| 6 |
-
#
|
|
|
|
| 7 |
OPENAI_KEYS = [
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
]
|
| 14 |
|
| 15 |
-
# DeepSeek keys (fallback)
|
| 16 |
DEEPSEEK_KEYS = [
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
os.getenv("DEEPSEEK_KEY_5", "").strip()
|
| 23 |
]
|
| 24 |
|
| 25 |
def try_openai(prompt, key):
|
|
@@ -67,14 +65,12 @@ def try_deepseek(prompt, key):
|
|
| 67 |
return f"[ERROR] DeepSeek Exception: {str(e)}"
|
| 68 |
|
| 69 |
def multi_query(prompt):
|
| 70 |
-
# Try OpenAI first
|
| 71 |
for key in OPENAI_KEYS:
|
| 72 |
if key:
|
| 73 |
response = try_openai(prompt, key)
|
| 74 |
if not response.startswith("[ERROR]"):
|
| 75 |
return response
|
| 76 |
|
| 77 |
-
# Fallback to DeepSeek
|
| 78 |
for key in DEEPSEEK_KEYS:
|
| 79 |
if key:
|
| 80 |
response = try_deepseek(prompt, key)
|
|
|
|
| 1 |
+
# multi_inference.py (unsafe version — hardcoded API keys)
|
| 2 |
|
| 3 |
import requests
|
|
|
|
| 4 |
|
| 5 |
+
# === HARD CODED API KEYS ===
|
| 6 |
+
|
| 7 |
OPENAI_KEYS = [
|
| 8 |
+
"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",
|
| 9 |
+
"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",
|
| 10 |
+
"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",
|
| 11 |
+
"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",
|
| 12 |
+
"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"
|
| 13 |
]
|
| 14 |
|
|
|
|
| 15 |
DEEPSEEK_KEYS = [
|
| 16 |
+
"sk-6de286df19b04cac8bf6295a2114b0aa",
|
| 17 |
+
"sk-5b4ecbbd66864a88925525fab14430d1",
|
| 18 |
+
"sk-9c216dd03c9945218f12475a0fa6c8c4",
|
| 19 |
+
"sk-79f0d8a98b88447880c01d012c572831",
|
| 20 |
+
"sk-2be33a5e561b4788b9446e4e4e99bc2e"
|
|
|
|
| 21 |
]
|
| 22 |
|
| 23 |
def try_openai(prompt, key):
|
|
|
|
| 65 |
return f"[ERROR] DeepSeek Exception: {str(e)}"
|
| 66 |
|
| 67 |
def multi_query(prompt):
|
|
|
|
| 68 |
for key in OPENAI_KEYS:
|
| 69 |
if key:
|
| 70 |
response = try_openai(prompt, key)
|
| 71 |
if not response.startswith("[ERROR]"):
|
| 72 |
return response
|
| 73 |
|
|
|
|
| 74 |
for key in DEEPSEEK_KEYS:
|
| 75 |
if key:
|
| 76 |
response = try_deepseek(prompt, key)
|