Spaces:
Runtime error
Runtime error
Max Brodeur-Urbas
commited on
Commit
·
6912fb9
1
Parent(s):
bbb40b3
Removing prediction count
Browse files
app.py
CHANGED
@@ -33,22 +33,15 @@ from base64 import b64decode
|
|
33 |
from io import BytesIO
|
34 |
run_cmd('pip -q install pydub')
|
35 |
from pydub import AudioSegment
|
36 |
-
prediction_count = 0
|
37 |
-
failed_prediction_count = 0
|
38 |
|
39 |
def predict(audio_file_path):
|
40 |
input_data = open(audio_file_path, 'rb').read()
|
41 |
print(len(input_data))
|
42 |
|
43 |
if(len(input_data) == 88108 or len(input_data) == 94252):
|
44 |
-
failed_prediction_count += 1
|
45 |
output = "It appears your recording device isn't supported by Hugging Face/Gradio yet (iOS and macOS are causing issues). Windows and android record properly, sorry for the temporary inconvenience!"
|
46 |
return output, {}, ""
|
47 |
-
|
48 |
-
prediction_count += 1
|
49 |
-
|
50 |
-
print("Prediction count: " + str(prediction_count))
|
51 |
-
print("Failed prediction count: " + str(failed_prediction_count))
|
52 |
# Set the content type
|
53 |
headers = {'Content-Type': 'application/json'}
|
54 |
# If authentication is enabled, set the authorization header
|
|
|
33 |
from io import BytesIO
|
34 |
run_cmd('pip -q install pydub')
|
35 |
from pydub import AudioSegment
|
|
|
|
|
36 |
|
37 |
def predict(audio_file_path):
|
38 |
input_data = open(audio_file_path, 'rb').read()
|
39 |
print(len(input_data))
|
40 |
|
41 |
if(len(input_data) == 88108 or len(input_data) == 94252):
|
|
|
42 |
output = "It appears your recording device isn't supported by Hugging Face/Gradio yet (iOS and macOS are causing issues). Windows and android record properly, sorry for the temporary inconvenience!"
|
43 |
return output, {}, ""
|
44 |
+
|
|
|
|
|
|
|
|
|
45 |
# Set the content type
|
46 |
headers = {'Content-Type': 'application/json'}
|
47 |
# If authentication is enabled, set the authorization header
|