Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,36 +1,22 @@
|
|
| 1 |
import requests
|
| 2 |
-
import json
|
| 3 |
|
| 4 |
-
|
| 5 |
-
API_KEY = "DEEPSEEK_API_KEY"
|
| 6 |
-
API_URL = "https://api.deepseek.com/v1/chat/completions" # Example endpoint, check documentation
|
| 7 |
-
|
| 8 |
-
# Define the prompt in Bahasa Indonesia
|
| 9 |
-
prompt = "Halo, bisakah kamu membantu saya membuat rencana perjalanan ke Bali?"
|
| 10 |
-
|
| 11 |
-
# Prepare the payload
|
| 12 |
-
payload = {
|
| 13 |
-
"model": "deepseek-ai/DeepSeek-V3", # Replace with the model you want to use
|
| 14 |
-
"messages": [
|
| 15 |
-
{"role": "user", "content": prompt}
|
| 16 |
-
],
|
| 17 |
-
"max_tokens": 150, # Adjust as needed
|
| 18 |
-
"temperature": 0.7, # Adjust for creativity
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
# Set headers
|
| 22 |
headers = {
|
| 23 |
-
"Authorization": f"Bearer {API_KEY}",
|
| 24 |
"Content-Type": "application/json",
|
|
|
|
| 25 |
}
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import requests
|
|
|
|
| 2 |
|
| 3 |
+
url = "https://api.hyperbolic.xyz/v1/chat/completions"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
headers = {
|
|
|
|
| 5 |
"Content-Type": "application/json",
|
| 6 |
+
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJtaXRyYWxlc3RhcmlwZXJzYWRhQGdtYWlsLmNvbSIsImlhdCI6MTczNjUwMzQxMX0.yuIoZsH1jouAlixx_h_eQ-bltZ1sg4alrJHMHr1axvA"
|
| 7 |
}
|
| 8 |
+
data = {
|
| 9 |
+
"messages": [
|
| 10 |
+
{
|
| 11 |
+
"role": "user",
|
| 12 |
+
"content": "What can I do in SF?"
|
| 13 |
+
}
|
| 14 |
+
],
|
| 15 |
+
"model": "deepseek-ai/DeepSeek-V3",
|
| 16 |
+
"max_tokens": 512,
|
| 17 |
+
"temperature": 0.1,
|
| 18 |
+
"top_p": 0.9
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
response = requests.post(url, headers=headers, json=data)
|
| 22 |
+
print(response.json())
|