StormblessedKal commited on
Commit
f7c6cdb
·
1 Parent(s): cb1e3b7
Files changed (1) hide show
  1. src/predict.py +5 -5
src/predict.py CHANGED
@@ -153,12 +153,8 @@ class Predictor:
153
  bucket_name = 'demovidelyuseruploads'
154
  if b'WAVE' in header:
155
  file_format = 'wav'
156
- elif header.startswith((b'\xff\xfb', b'\xff\xf3', b'\xff\xe3', b'\xff\xfa')):
157
- file_format = 'mp3'
158
  else:
159
- file_format = 'unknown'
160
- if file_format == 'unknown':
161
- return {'error':'unrecognized file format, encode audio file as base64 str'}
162
 
163
  unique_filename = f"{uuid.uuid4()}"
164
 
@@ -173,6 +169,8 @@ class Predictor:
173
  os.remove(local_filename)
174
  print(wav_filename)
175
 
 
 
176
  # if cut_audio > 0, means it was set
177
  if cut_audio > 0:
178
  #need to cut
@@ -323,6 +321,8 @@ class Predictor:
323
  bucket_name = 'demovidelyuseruploads'
324
  local_file_path = os.path.join(raw_dir,s3_key)
325
  self.download_file_from_s3(self.s3_client,bucket_name,s3_key,local_file_path)
 
 
326
 
327
  _,tone_color_converter = self.base_speaker_tts,self.tone_color_converter
328
  reference_speaker = local_file_path
 
153
  bucket_name = 'demovidelyuseruploads'
154
  if b'WAVE' in header:
155
  file_format = 'wav'
 
 
156
  else:
157
+ file_format = 'mp3'
 
 
158
 
159
  unique_filename = f"{uuid.uuid4()}"
160
 
 
169
  os.remove(local_filename)
170
  print(wav_filename)
171
 
172
+ model,sampler = self.model,self.sampler
173
+ result = self.process_audio_file(wav_filename,'this is a sample test to quickly run this model and resample',model,sampler)
174
  # if cut_audio > 0, means it was set
175
  if cut_audio > 0:
176
  #need to cut
 
321
  bucket_name = 'demovidelyuseruploads'
322
  local_file_path = os.path.join(raw_dir,s3_key)
323
  self.download_file_from_s3(self.s3_client,bucket_name,s3_key,local_file_path)
324
+ model,sampler = self.model,self.sampler
325
+ result = self.process_audio_file(local_file_path,'this is a sample test to quickly run this model and resample',model,sampler)
326
 
327
  _,tone_color_converter = self.base_speaker_tts,self.tone_color_converter
328
  reference_speaker = local_file_path