YinuoGuo27 commited on
Commit
e2732df
·
verified ·
1 Parent(s): 01686f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -32,6 +32,7 @@ def set_tts():
32
  def create_kd_talker():
33
  return Inferencer()
34
 
 
35
  def predict(prompt, upload_reference_audio, microphone_reference_audio, reference_audio_type):
36
  global result_dir
37
  output_file_path = os.path.join(result_dir, 'output.wav')
@@ -49,6 +50,10 @@ def predict(prompt, upload_reference_audio, microphone_reference_audio, referenc
49
  )
50
  return gr.Audio(value=output_file_path, type='filepath')
51
 
 
 
 
 
52
 
53
 
54
  @spaces.GPU
@@ -108,9 +113,8 @@ def main():
108
  smoothed_roll = gr.Slider(minimum=0, maximum=1, step=0.1, label="Roll", value=0.8)
109
  smoothed_t = gr.Slider(minimum=0, maximum=1, step=0.1, label="T", value=0.8)
110
  kd_submit = gr.Button("Generate", elem_id="kdtalker_generate", variant="primary")
111
- kdtalker = Inferencer()
112
  kd_submit.click(
113
- fn=kdtalker.generate_with_audio_img,
114
  inputs=[
115
  upload_driven_audio, tts_driven_audio, driven_audio_type, source_image,
116
  smoothed_pitch, smoothed_yaw, smoothed_roll, smoothed_t
 
32
  def create_kd_talker():
33
  return Inferencer()
34
 
35
+ @spaces.GPU
36
  def predict(prompt, upload_reference_audio, microphone_reference_audio, reference_audio_type):
37
  global result_dir
38
  output_file_path = os.path.join(result_dir, 'output.wav')
 
50
  )
51
  return gr.Audio(value=output_file_path, type='filepath')
52
 
53
+ @spaces.GPU
54
+ def generate(upload_driven_audio, tts_driven_audio, driven_audio_type, source_image, smoothed_pitch, smoothed_yaw, smoothed_roll, smoothed_t):
55
+ return Inferencer().generate_with_audio_img(upload_driven_audio, tts_driven_audio, driven_audio_type, source_image,
56
+ smoothed_pitch, smoothed_yaw, smoothed_roll, smoothed_t)
57
 
58
 
59
  @spaces.GPU
 
113
  smoothed_roll = gr.Slider(minimum=0, maximum=1, step=0.1, label="Roll", value=0.8)
114
  smoothed_t = gr.Slider(minimum=0, maximum=1, step=0.1, label="T", value=0.8)
115
  kd_submit = gr.Button("Generate", elem_id="kdtalker_generate", variant="primary")
 
116
  kd_submit.click(
117
+ fn=generate,
118
  inputs=[
119
  upload_driven_audio, tts_driven_audio, driven_audio_type, source_image,
120
  smoothed_pitch, smoothed_yaw, smoothed_roll, smoothed_t