oberbics commited on
Commit
f683120
·
verified ·
1 Parent(s): 26a1605

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -11,15 +11,15 @@ headers = {"Authorization": f"Bearer {api_token}"}
11
 
12
 
13
  def query_api(payload):
14
- response = requests.post(API_URL, headers=headers, json=payload)
15
-
16
- # Debug logs
17
- print("API STATUS CODE:", response.status_code)
18
- print("RAW RESPONSE:", response.text)
19
-
20
  try:
 
 
 
 
 
21
  return response.json()
22
  except Exception as e:
 
23
  return {"error": f"Could not decode JSON: {str(e)}"}
24
 
25
 
@@ -41,7 +41,7 @@ def extract_structure(template, text):
41
 
42
  # Check for API error
43
  if isinstance(response, dict) and "error" in response:
44
- return f"API Error: {response['error']}", "{}", f"<p>Error occurred: {response['error']}</p>"
45
 
46
  # Get generated text
47
  if isinstance(response, list) and len(response) > 0:
 
11
 
12
 
13
  def query_api(payload):
 
 
 
 
 
 
14
  try:
15
+ response = requests.post(API_URL, headers=headers, json=payload)
16
+ # Debug logs
17
+ print("API STATUS CODE:", response.status_code)
18
+ print("RAW RESPONSE:", response.text)
19
+
20
  return response.json()
21
  except Exception as e:
22
+ print("Error during API call:", e)
23
  return {"error": f"Could not decode JSON: {str(e)}"}
24
 
25
 
 
41
 
42
  # Check for API error
43
  if isinstance(response, dict) and "error" in response:
44
+ return f"API Error: {response['error']}", "{}", "<p>Error occurred: {response['error']}</p>"
45
 
46
  # Get generated text
47
  if isinstance(response, list) and len(response) > 0: