imorcillo commited on
Commit
5b5c6c7
·
verified ·
1 Parent(s): 3828e6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -16,8 +16,7 @@ def audio_to_bytes(audio):
16
  audio_bytes = io.BytesIO()
17
  sf.write(audio_bytes, data, sr, format='WAV')
18
  audio_bytes.seek(0)
19
- print(len(data), sr, len(data)/sr)
20
- if len(data)/sr >= 960000: return None
21
  return audio_bytes
22
 
23
  def langswitch_API_call(audio, language):
@@ -36,7 +35,7 @@ def transcribe_base(audio, language):
36
  try:
37
  response = langswitch_API_call(audio, language)
38
  print(response)
39
- if response == None: return "Audio file should be shorter than 1 minute."
40
  except Exception as e:
41
  if "Invalid file: None" in str(e):
42
  return "⚠️ Check that you have clicked the stop button or wait for the audio to load completely."
 
16
  audio_bytes = io.BytesIO()
17
  sf.write(audio_bytes, data, sr, format='WAV')
18
  audio_bytes.seek(0)
19
+ if len(data)/sr >= 60.0: return None
 
20
  return audio_bytes
21
 
22
  def langswitch_API_call(audio, language):
 
35
  try:
36
  response = langswitch_API_call(audio, language)
37
  print(response)
38
+ if response == None: return "Audio file too long! Audio file should be shorter than 1 minute."
39
  except Exception as e:
40
  if "Invalid file: None" in str(e):
41
  return "⚠️ Check that you have clicked the stop button or wait for the audio to load completely."