'audio_file': (os.path.basename(audio), f, 'audio/wav')
Browse files
app.py
CHANGED
|
@@ -35,18 +35,18 @@ def score_audio_plus(password, audio, api_plan, return_json):
|
|
| 35 |
}
|
| 36 |
|
| 37 |
# Prepare files and data for POST request
|
| 38 |
-
with open(audio, "rb") as
|
| 39 |
files = {
|
| 40 |
-
'audio_file':
|
| 41 |
}
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
if response.status_code == 200:
|
| 52 |
# Successfully made the request
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
# Prepare files and data for POST request
|
| 38 |
+
with open(audio, "rb") as f:
|
| 39 |
files = {
|
| 40 |
+
'audio_file': (os.path.basename(audio), f, 'audio/wav')
|
| 41 |
}
|
| 42 |
+
data = {
|
| 43 |
+
'api_plan': api_plan,
|
| 44 |
+
'return_json': "true" if return_json else "false"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
# Send POST request
|
| 48 |
+
response = requests.post(url, files=files, data=data, headers=headers)
|
| 49 |
+
|
| 50 |
|
| 51 |
if response.status_code == 200:
|
| 52 |
# Successfully made the request
|