Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
temperature=0.5,
|
| 13 |
-
top_p=0.7,
|
| 14 |
-
stream=True,
|
| 15 |
-
)
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
import requests
|
| 3 |
|
| 4 |
+
API_URL = "https://router.huggingface.co/hf-inference/models/HuggingFaceTB/SmolLM3-3B"
|
| 5 |
+
headers = {
|
| 6 |
+
"Authorization": f"Bearer {os.environ['HF_API_TOKEN']}",
|
| 7 |
+
}
|
| 8 |
|
| 9 |
+
def query(payload):
|
| 10 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 11 |
+
return response.json()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
response = query({
|
| 14 |
+
"messages": "\"Can you please let us know more details about your \"",
|
| 15 |
+
"model": "meta-llama/Llama-3.1-8B-Instruct:hf-inference"
|
| 16 |
+
})
|
| 17 |
+
|
| 18 |
+
print(response["choices"][0]["message"])
|