Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import requests
|
|
3 |
|
4 |
# Function to send your prompt to NVIDIA LLaMA 4 Scout
|
5 |
def talk_to_llama(prompt):
|
6 |
-
url = "https://api.nvcf.nvidia.com/
|
7 |
headers = {
|
8 |
"Authorization": "Bearer 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",
|
9 |
"Content-Type": "application/json"
|
@@ -12,10 +12,11 @@ def talk_to_llama(prompt):
|
|
12 |
"messages": [{"role": "user", "content": prompt}]
|
13 |
}
|
14 |
response = requests.post(url, headers=headers, json=data)
|
|
|
15 |
try:
|
16 |
return response.json()["choices"][0]["message"]["content"]
|
17 |
-
except:
|
18 |
-
return "Something went wrong. Here's what the server said
|
19 |
|
20 |
# Build the chatbot interface
|
21 |
chat = gr.Interface(
|
|
|
3 |
|
4 |
# Function to send your prompt to NVIDIA LLaMA 4 Scout
|
5 |
def talk_to_llama(prompt):
|
6 |
+
url = "https://api.nvcf.nvidia.com/v1/messages" # ✅ Correct endpoint
|
7 |
headers = {
|
8 |
"Authorization": "Bearer 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",
|
9 |
"Content-Type": "application/json"
|
|
|
12 |
"messages": [{"role": "user", "content": prompt}]
|
13 |
}
|
14 |
response = requests.post(url, headers=headers, json=data)
|
15 |
+
|
16 |
try:
|
17 |
return response.json()["choices"][0]["message"]["content"]
|
18 |
+
except Exception as e:
|
19 |
+
return f"Something went wrong. Here's what the server said:\n{response.text}"
|
20 |
|
21 |
# Build the chatbot interface
|
22 |
chat = gr.Interface(
|