Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,27 @@
|
|
| 1 |
-
import
|
| 2 |
-
import
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import os
|
| 3 |
|
| 4 |
+
api_key=os.environ.get("HYPERBOLIC_API_KEY")
|
| 5 |
+
url = "https://api.hyperbolic.xyz/v1/chat/completions"
|
| 6 |
+
|
| 7 |
+
def hyperbolic(prompt):
|
| 8 |
+
|
| 9 |
+
headers = {
|
| 10 |
+
"Content-Type": "application/json",
|
| 11 |
+
"Authorization": f"Bearer {api_key}"
|
| 12 |
+
}
|
| 13 |
+
data = {
|
| 14 |
+
"messages": [
|
| 15 |
+
{
|
| 16 |
+
"role": "user",
|
| 17 |
+
"content": f"{prompt}"
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"model": "Qwen/Qwen2.5-72B-Instruct",
|
| 21 |
+
"max_tokens": 32768,
|
| 22 |
+
"temperature": 0.2,
|
| 23 |
+
"top_p": 0.9
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
response = requests.post(url, headers=headers, json=data)
|
| 27 |
+
print(response.json())
|