Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -157,7 +157,6 @@ with gr.Blocks() as demo:
|
|
| 157 |
sound_design_output = gr.Textbox(label="Sound Design", lines=3)
|
| 158 |
music_suggestion_output = gr.Textbox(label="Music Suggestions", lines=3)
|
| 159 |
|
| 160 |
-
# Ensure the .click is inside this Blocks context
|
| 161 |
generate_script_button.click(
|
| 162 |
fn=lambda user_prompt, model_id, duration: generate_script(user_prompt, model_id, hf_token, duration),
|
| 163 |
inputs=[user_prompt, llama_model_id, duration],
|
|
@@ -172,7 +171,6 @@ with gr.Blocks() as demo:
|
|
| 172 |
generate_voice_button = gr.Button("Generate Voice")
|
| 173 |
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
| 174 |
|
| 175 |
-
# Ensure the .click is inside this Blocks context
|
| 176 |
generate_voice_button.click(
|
| 177 |
fn=generate_voice,
|
| 178 |
inputs=[script_output, speaker],
|
|
@@ -183,13 +181,24 @@ with gr.Blocks() as demo:
|
|
| 183 |
with gr.Tab("Step 3: Generate Music"):
|
| 184 |
with gr.Row():
|
| 185 |
audio_length = gr.Slider(label="Music Length (tokens)", minimum=128, maximum=1024, step=64, value=512)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
generate_music_button = gr.Button("Generate Music")
|
| 188 |
music_output = gr.Audio(label="Generated Music", type="filepath")
|
| 189 |
|
| 190 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
generate_music_button.click(
|
| 192 |
-
fn=generate_music,
|
| 193 |
inputs=[music_suggestion_output, audio_length],
|
| 194 |
outputs=[music_output],
|
| 195 |
)
|
|
@@ -202,7 +211,6 @@ with gr.Blocks() as demo:
|
|
| 202 |
blend_button = gr.Button("Blend Audio")
|
| 203 |
final_output = gr.Audio(label="Final Promo Audio", type="filepath")
|
| 204 |
|
| 205 |
-
# Ensure the .click is inside this Blocks context
|
| 206 |
blend_button.click(
|
| 207 |
fn=blend_audio,
|
| 208 |
inputs=[voice_output, music_output, ducking],
|
|
@@ -216,4 +224,4 @@ with gr.Blocks() as demo:
|
|
| 216 |
</p>
|
| 217 |
""")
|
| 218 |
|
| 219 |
-
demo.launch(debug=True)
|
|
|
|
| 157 |
sound_design_output = gr.Textbox(label="Sound Design", lines=3)
|
| 158 |
music_suggestion_output = gr.Textbox(label="Music Suggestions", lines=3)
|
| 159 |
|
|
|
|
| 160 |
generate_script_button.click(
|
| 161 |
fn=lambda user_prompt, model_id, duration: generate_script(user_prompt, model_id, hf_token, duration),
|
| 162 |
inputs=[user_prompt, llama_model_id, duration],
|
|
|
|
| 171 |
generate_voice_button = gr.Button("Generate Voice")
|
| 172 |
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
| 173 |
|
|
|
|
| 174 |
generate_voice_button.click(
|
| 175 |
fn=generate_voice,
|
| 176 |
inputs=[script_output, speaker],
|
|
|
|
| 181 |
with gr.Tab("Step 3: Generate Music"):
|
| 182 |
with gr.Row():
|
| 183 |
audio_length = gr.Slider(label="Music Length (tokens)", minimum=128, maximum=1024, step=64, value=512)
|
| 184 |
+
music_prompt_display = gr.Textbox(
|
| 185 |
+
label="Music Suggestions from Step 1",
|
| 186 |
+
lines=3,
|
| 187 |
+
interactive=False
|
| 188 |
+
)
|
| 189 |
|
| 190 |
generate_music_button = gr.Button("Generate Music")
|
| 191 |
music_output = gr.Audio(label="Generated Music", type="filepath")
|
| 192 |
|
| 193 |
+
# Pass music suggestions from Step 1 to Step 3
|
| 194 |
+
generate_script_button.click(
|
| 195 |
+
fn=lambda _, __, ___: None, # Dummy function to update the display
|
| 196 |
+
inputs=[],
|
| 197 |
+
outputs=[music_suggestion_output],
|
| 198 |
+
)
|
| 199 |
+
|
| 200 |
generate_music_button.click(
|
| 201 |
+
fn=lambda prompt, audio_length: generate_music(prompt, audio_length),
|
| 202 |
inputs=[music_suggestion_output, audio_length],
|
| 203 |
outputs=[music_output],
|
| 204 |
)
|
|
|
|
| 211 |
blend_button = gr.Button("Blend Audio")
|
| 212 |
final_output = gr.Audio(label="Final Promo Audio", type="filepath")
|
| 213 |
|
|
|
|
| 214 |
blend_button.click(
|
| 215 |
fn=blend_audio,
|
| 216 |
inputs=[voice_output, music_output, ducking],
|
|
|
|
| 224 |
</p>
|
| 225 |
""")
|
| 226 |
|
| 227 |
+
demo.launch(debug=True)
|