StormblessedKal commited on
Commit
2fa9424
1 Parent(s): 46dd7aa

support input ogg

Browse files
Files changed (2) hide show
  1. src/predict.py +3 -1
  2. src/rp_schema.py +1 -1
src/predict.py CHANGED
@@ -153,6 +153,8 @@ class Predictor:
153
  bucket_name = 'demovidelyuseruploads'
154
  if b'WAVE' in header:
155
  file_format = 'wav'
 
 
156
  else:
157
  file_format = 'mp3'
158
 
@@ -163,7 +165,7 @@ class Predictor:
163
  file_out.write(file_bytes)
164
 
165
  wav_filename = local_filename
166
- if file_format == "mp3":
167
  wav_filename = f"{unique_filename}.wav"
168
  subprocess.run(["ffmpeg", "-i", local_filename, wav_filename])
169
  os.remove(local_filename)
 
153
  bucket_name = 'demovidelyuseruploads'
154
  if b'WAVE' in header:
155
  file_format = 'wav'
156
+ elif b'OggS' in header:
157
+ file_format = 'ogg'
158
  else:
159
  file_format = 'mp3'
160
 
 
165
  file_out.write(file_bytes)
166
 
167
  wav_filename = local_filename
168
+ if file_format != "wav":
169
  wav_filename = f"{unique_filename}.wav"
170
  subprocess.run(["ffmpeg", "-i", local_filename, wav_filename])
171
  os.remove(local_filename)
src/rp_schema.py CHANGED
@@ -37,6 +37,6 @@ INPUT_VALIDATIONS = {
37
  'output_extension': {
38
  'type': str,
39
  'required': False,
40
- 'default': 'ogg'
41
  }
42
  }
 
37
  'output_extension': {
38
  'type': str,
39
  'required': False,
40
+ 'default': 'mp3'
41
  }
42
  }