ahassoun commited on
Commit
4ffbe02
·
1 Parent(s): 5b8e16a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from TTS.api import TTS
2
  import gradio as gr
3
  from gradio import Dropdown
4
  from scipy.io.wavfile import write
@@ -30,13 +30,14 @@ script_choices = {
30
  "Random": "Grandma, I can’t find your email address. I need to send you something important."
31
  }
32
  }
33
- tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)
34
 
35
 
36
- def infer(prompt, input_wav_file, script_type):
37
  print("Prompt:", prompt)
38
  print("Input WAV File:", input_wav_file)
39
  print("Script Type:", script_type)
 
40
  print("""
41
  —————
42
  NEW INFERENCE:
@@ -70,7 +71,7 @@ NEW INFERENCE:
70
  else:
71
  prompt = prompt
72
 
73
- theme_dict = script_choices.get(theme_dropdown.value, {})
74
  chosen_script = theme_dict.get(script_type, "")
75
 
76
  gr.Info("Generating audio from prompt")
@@ -208,7 +209,7 @@ with gr.Blocks(css=css) as demo:
208
 
209
  submit_btn.click(
210
  fn=infer,
211
- inputs=[script_text, micro_in, script_type_dropdown],
212
  outputs=[cloned_out, video_out, npz_file, folder_path]
213
  )
214
  demo.queue(api_open=False, max_size=10).launch()
 
1
+ # from TTS.api import TTS
2
  import gradio as gr
3
  from gradio import Dropdown
4
  from scipy.io.wavfile import write
 
30
  "Random": "Grandma, I can’t find your email address. I need to send you something important."
31
  }
32
  }
33
+ # tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)
34
 
35
 
36
+ def infer(prompt, input_wav_file, script_type,selected_theme):
37
  print("Prompt:", prompt)
38
  print("Input WAV File:", input_wav_file)
39
  print("Script Type:", script_type)
40
+ print(selected_theme)
41
  print("""
42
  —————
43
  NEW INFERENCE:
 
71
  else:
72
  prompt = prompt
73
 
74
+ theme_dict = script_choices.get(selected_theme, {})
75
  chosen_script = theme_dict.get(script_type, "")
76
 
77
  gr.Info("Generating audio from prompt")
 
209
 
210
  submit_btn.click(
211
  fn=infer,
212
+ inputs=[script_text, micro_in, script_type_dropdown,theme_dropdown],
213
  outputs=[cloned_out, video_out, npz_file, folder_path]
214
  )
215
  demo.queue(api_open=False, max_size=10).launch()