Spaces:
Sleeping
Sleeping
Delete inference.py
Browse files- inference.py +0 -32
inference.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
# inference.py
|
2 |
-
|
3 |
-
import requests
|
4 |
-
import os
|
5 |
-
|
6 |
-
API_KEY = os.getenv("DEEPSEEK_KEY", "").strip()
|
7 |
-
|
8 |
-
def deepseek_query(prompt):
|
9 |
-
url = "https://api.deepseek.com/v1/chat/completions"
|
10 |
-
headers = {
|
11 |
-
"Authorization": f"Bearer {API_KEY}",
|
12 |
-
"Content-Type": "application/json"
|
13 |
-
}
|
14 |
-
data = {
|
15 |
-
"model": "deepseek-chat",
|
16 |
-
"messages": [
|
17 |
-
{"role": "system", "content": "You are a helpful, creative AI agent."},
|
18 |
-
{"role": "user", "content": prompt}
|
19 |
-
]
|
20 |
-
}
|
21 |
-
|
22 |
-
try:
|
23 |
-
response = requests.post(url, json=data, headers=headers)
|
24 |
-
result = response.json()
|
25 |
-
|
26 |
-
# ✅ Debug: Print whole response if there's an issue
|
27 |
-
if "choices" not in result:
|
28 |
-
return f"[ERROR] choices not found in response: {result}"
|
29 |
-
|
30 |
-
return result["choices"][0]["message"]["content"]
|
31 |
-
except Exception as e:
|
32 |
-
return f"[ERROR] {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|