Baghdad99 commited on
Commit
a927d1d
1 Parent(s): 0451cd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -17,7 +17,12 @@ def query(api_url, payload=None, data=None):
17
  response = requests.post(api_url, headers=headers, data=data)
18
  else:
19
  response = requests.post(api_url, headers=headers, json=payload)
20
- return response.json()
 
 
 
 
 
21
 
22
  # Define the function to translate speech
23
  def translate_speech(audio_file):
 
17
  response = requests.post(api_url, headers=headers, data=data)
18
  else:
19
  response = requests.post(api_url, headers=headers, json=payload)
20
+ response_json = response.json()
21
+ if 'error' in response_json:
22
+ print(f"Error in query function: {response_json['error']}")
23
+ return None
24
+ return response_json
25
+
26
 
27
  # Define the function to translate speech
28
  def translate_speech(audio_file):