ahassoun commited on
Commit
4fabf02
1 Parent(s): 9170560

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -149,11 +149,10 @@ def load_hidden_mic(audio_in):
149
  def update_script_text(theme, script_type):
150
  positive_script = script_choices.get(theme, {}).get("Positive", "")
151
  output_script = script_choices.get(theme, {}).get(script_type, "")
152
-
153
- # Step 3: Update the new component whenever the theme dropdown changes
154
  theme_emoji = theme_emojis.get(theme, "")
155
 
156
- return positive_script, output_script, theme_emoji
 
157
 
158
 
159
  with gr.Blocks(css=css) as demo:
@@ -175,11 +174,12 @@ with gr.Blocks(css=css) as demo:
175
  lines=5,
176
  )
177
  theme_dropdown.change(fn=update_script_text, inputs=[
178
- theme_dropdown, script_type_dropdown], outputs=[script_text, output_script_text])
179
  script_type_dropdown.change(fn=update_script_text, inputs=[
180
- theme_dropdown, script_type_dropdown], outputs=[script_text, output_script_text])
181
  theme_dropdown.change(fn=update_script_text, inputs=[theme_dropdown, script_type_dropdown], outputs=[
182
- script_text, output_script_text, theme_emoji_output])
 
183
 
184
  # Replace file input with microphone input
185
  micro_in = gr.Audio(
@@ -208,8 +208,8 @@ with gr.Blocks(css=css) as demo:
208
  hidden_audio_numpy], queue=False)
209
 
210
  submit_btn.click(
211
- fn=infer,
212
- inputs=[script_text, micro_in, script_type_dropdown,theme_dropdown.value],
213
- outputs=[cloned_out, video_out, npz_file, folder_path]
214
- )
215
  demo.queue(api_open=False, max_size=10).launch()
 
149
  def update_script_text(theme, script_type):
150
  positive_script = script_choices.get(theme, {}).get("Positive", "")
151
  output_script = script_choices.get(theme, {}).get(script_type, "")
 
 
152
  theme_emoji = theme_emojis.get(theme, "")
153
 
154
+ return positive_script, output_script, theme_emoji, theme # Include theme as an output
155
+
156
 
157
 
158
  with gr.Blocks(css=css) as demo:
 
174
  lines=5,
175
  )
176
  theme_dropdown.change(fn=update_script_text, inputs=[
177
+ theme_dropdown, script_type_dropdown], outputs=[script_text, output_script_text, theme_emoji_output, theme_output])
178
  script_type_dropdown.change(fn=update_script_text, inputs=[
179
+ theme_dropdown, script_type_dropdown], outputs=[script_text, output_script_text, theme_emoji_output, theme_output])
180
  theme_dropdown.change(fn=update_script_text, inputs=[theme_dropdown, script_type_dropdown], outputs=[
181
+ script_text, output_script_text, theme_emoji_output, theme_output])
182
+
183
 
184
  # Replace file input with microphone input
185
  micro_in = gr.Audio(
 
208
  hidden_audio_numpy], queue=False)
209
 
210
  submit_btn.click(
211
+ fn=infer,
212
+ inputs=[script_text, micro_in, script_type_dropdown, theme_output], # Pass theme_output
213
+ outputs=[cloned_out, video_out, npz_file, folder_path]
214
+ )
215
  demo.queue(api_open=False, max_size=10).launch()