pragnakalp commited on
Commit
1039ad0
·
1 Parent(s): 631b921

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -167,6 +167,7 @@ def one_shot(image_in,input_text,gender):
167
  tts.write_to_fp(f)
168
  f.seek(0)
169
  sound = AudioSegment.from_file(f.name, format="mp3")
 
170
  sound.export("/content/audio.wav", format="wav")
171
  audio_in="/content/audio.wav"
172
  return one_shot_talking(image_in,audio_in)
@@ -189,7 +190,9 @@ def one_shot(image_in,input_text,gender):
189
 
190
  wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
191
  # soundfile.write("/content/audio_before.wav", wav, rate)
 
192
  soundfile.write("/content/audio_before.wav", wav.cpu().clone().numpy(), rate)
 
193
  cmd='ffmpeg -i /content/audio_before.wav -filter:a "atempo=0.7" -vn /content/audio.wav'
194
  os.system(cmd)
195
  audio_in="/content/audio.wav"
@@ -206,7 +209,7 @@ def run():
206
  image_in = gr.Image(show_label=True, type="filepath",label="Input Image")
207
  input_text = gr.Textbox(show_label=True,label="Input Text")
208
  gender = gr.Radio(["Female","Male"],value="Female",label="Gender")
209
- video_out = gr.Textbox(show_label=True,label="Output")
210
  with gr.Row().style(equal_height=True):
211
  btn = gr.Button("Generate")
212
  gr.Markdown(
 
167
  tts.write_to_fp(f)
168
  f.seek(0)
169
  sound = AudioSegment.from_file(f.name, format="mp3")
170
+ os.system(f"rm -rf /content/audio.wav")
171
  sound.export("/content/audio.wav", format="wav")
172
  audio_in="/content/audio.wav"
173
  return one_shot_talking(image_in,audio_in)
 
190
 
191
  wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
192
  # soundfile.write("/content/audio_before.wav", wav, rate)
193
+ os.system(f"rm -rf /content/audio_before.wav")
194
  soundfile.write("/content/audio_before.wav", wav.cpu().clone().numpy(), rate)
195
+ os.system(f"rm -rf /content/audio.wav")
196
  cmd='ffmpeg -i /content/audio_before.wav -filter:a "atempo=0.7" -vn /content/audio.wav'
197
  os.system(cmd)
198
  audio_in="/content/audio.wav"
 
209
  image_in = gr.Image(show_label=True, type="filepath",label="Input Image")
210
  input_text = gr.Textbox(show_label=True,label="Input Text")
211
  gender = gr.Radio(["Female","Male"],value="Female",label="Gender")
212
+ video_out = gr.Video(show_label=True,label="Output")
213
  with gr.Row().style(equal_height=True):
214
  btn = gr.Button("Generate")
215
  gr.Markdown(