OpenSound commited on
Commit
0322abf
·
1 Parent(s): f52a712

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -173,7 +173,7 @@ def run(seed, sub_amount, codec_audio_sr, codec_sr, top_k, top_p, temperature,
173
  target_transcript = replace_numbers_with_words(transcript).replace(" ", " ").replace(" ", " ").replace("\n", " ")
174
  orig_transcript = replace_numbers_with_words(original_transcript).replace(" ", " ").replace(" ", " ").replace("\n", " ")
175
 
176
- [orig_transcript, segments, _] = transcribe(audio_path)
177
  orig_transcript = orig_transcript.lower()
178
  target_transcript = target_transcript.lower()
179
  transcribe_state,_ = align(segments, audio_path)
@@ -195,7 +195,7 @@ def run(seed, sub_amount, codec_audio_sr, codec_sr, top_k, top_p, temperature,
195
 
196
  audio, _ = librosa.load(audio_path, sr=16000, duration=cut_length)
197
  sf.write(audio_path, audio, 16000)
198
- [orig_transcript, segments, _] = transcribe(audio_path)
199
 
200
 
201
  orig_transcript = orig_transcript.lower()
@@ -275,7 +275,7 @@ def run(seed, sub_amount, codec_audio_sr, codec_sr, top_k, top_p, temperature,
275
  new_audio = new_audio[0].cpu()
276
  torchaudio.save(audio_path, new_audio, codec_audio_sr)
277
  if tts: # remove the start parts
278
- [new_transcript, new_segments, _] = transcribe(audio_path)
279
  transcribe_state,_ = align(new_segments, audio_path)
280
  tmp1 = transcribe_state['segments'][0]['words'][0]['word'].lower()
281
  tmp2 = target_transcript_copy.lower()
@@ -292,17 +292,18 @@ def run(seed, sub_amount, codec_audio_sr, codec_sr, top_k, top_p, temperature,
292
  return output_audio, success_message
293
 
294
 
295
- demo_original_transcript = "Gwynplaine had, besides, for his work and for his feats of strength, round his neck and over his shoulders, an esclavine of leather."
296
 
297
  demo_text = {
298
  "TTS": {
299
- "regular": "Gwynplaine had, besides, for his work and for his feats of strength, I cannot believe that the same model can also do text to speech synthesis too!"
300
  },
301
  "Edit": {
302
- "regular": "Gwynplaine had, besides, for his work and for his feats of strength, take over the stage for half an hour, an esclavine of leather."
303
  },
304
  }
305
 
 
306
  def get_app():
307
  with gr.Blocks() as app:
308
  gr.Markdown("""
 
173
  target_transcript = replace_numbers_with_words(transcript).replace(" ", " ").replace(" ", " ").replace("\n", " ")
174
  orig_transcript = replace_numbers_with_words(original_transcript).replace(" ", " ").replace(" ", " ").replace("\n", " ")
175
 
176
+ [orig_transcript, segments, _, _] = transcribe(audio_path)
177
  orig_transcript = orig_transcript.lower()
178
  target_transcript = target_transcript.lower()
179
  transcribe_state,_ = align(segments, audio_path)
 
195
 
196
  audio, _ = librosa.load(audio_path, sr=16000, duration=cut_length)
197
  sf.write(audio_path, audio, 16000)
198
+ [orig_transcript, segments, _, _] = transcribe(audio_path)
199
 
200
 
201
  orig_transcript = orig_transcript.lower()
 
275
  new_audio = new_audio[0].cpu()
276
  torchaudio.save(audio_path, new_audio, codec_audio_sr)
277
  if tts: # remove the start parts
278
+ [new_transcript, new_segments, _, _] = transcribe(audio_path)
279
  transcribe_state,_ = align(new_segments, audio_path)
280
  tmp1 = transcribe_state['segments'][0]['words'][0]['word'].lower()
281
  tmp2 = target_transcript_copy.lower()
 
292
  return output_audio, success_message
293
 
294
 
295
+ demo_original_transcript = "Gwynplain had besides for his work and for his feats of strength, round his neck and over his shoulders, an esclavine of leather."
296
 
297
  demo_text = {
298
  "TTS": {
299
+ "regular": "Gwynplain had besides for his work and for his feats of strength, I cannot believe that the same model can also do text to speech synthesis too!"
300
  },
301
  "Edit": {
302
+ "regular": "Gwynplain had besides for his work and feats of strength, hanging from his neck and shoulders, an esclavine of leather."
303
  },
304
  }
305
 
306
+
307
  def get_app():
308
  with gr.Blocks() as app:
309
  gr.Markdown("""