mvcrockett commited on
Commit
a819876
·
verified ·
1 Parent(s): 257fbd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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/v2/completions"
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: " + str(response.text)
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(