Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,8 +45,8 @@ def generate_script(user_prompt: str, model_id: str, token: str, duration: int):
|
|
| 45 |
|
| 46 |
# Extract the script and music suggestion
|
| 47 |
generated_text = result[0]["generated_text"]
|
| 48 |
-
if "Music
|
| 49 |
-
parts = generated_text.split("Music
|
| 50 |
script = parts[0].strip()
|
| 51 |
music_suggestion = parts[1].strip()
|
| 52 |
return script, music_suggestion
|
|
@@ -137,7 +137,8 @@ with gr.Blocks() as demo:
|
|
| 137 |
ducking = gr.Checkbox(label="Enable Ducking", value=True)
|
| 138 |
|
| 139 |
generate_script_button = gr.Button("Generate Script")
|
| 140 |
-
script_output = gr.Textbox(label="Generated Script
|
|
|
|
| 141 |
generate_voice_button = gr.Button("Generate Voice")
|
| 142 |
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
| 143 |
generate_music_button = gr.Button("Generate Music")
|
|
@@ -160,7 +161,7 @@ with gr.Blocks() as demo:
|
|
| 160 |
generate_script_button.click(
|
| 161 |
fn=step_generate_script,
|
| 162 |
inputs=[user_prompt, llama_model_id, duration],
|
| 163 |
-
outputs=[script_output],
|
| 164 |
)
|
| 165 |
|
| 166 |
generate_voice_button.click(
|
|
@@ -171,7 +172,7 @@ with gr.Blocks() as demo:
|
|
| 171 |
|
| 172 |
generate_music_button.click(
|
| 173 |
fn=step_generate_music,
|
| 174 |
-
inputs=[
|
| 175 |
outputs=[music_output],
|
| 176 |
)
|
| 177 |
|
|
|
|
| 45 |
|
| 46 |
# Extract the script and music suggestion
|
| 47 |
generated_text = result[0]["generated_text"]
|
| 48 |
+
if "Music:" in generated_text:
|
| 49 |
+
parts = generated_text.split("Music:", 1)
|
| 50 |
script = parts[0].strip()
|
| 51 |
music_suggestion = parts[1].strip()
|
| 52 |
return script, music_suggestion
|
|
|
|
| 137 |
ducking = gr.Checkbox(label="Enable Ducking", value=True)
|
| 138 |
|
| 139 |
generate_script_button = gr.Button("Generate Script")
|
| 140 |
+
script_output = gr.Textbox(label="Generated Script")
|
| 141 |
+
music_suggestion_output = gr.Textbox(label="Music Suggestion")
|
| 142 |
generate_voice_button = gr.Button("Generate Voice")
|
| 143 |
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
| 144 |
generate_music_button = gr.Button("Generate Music")
|
|
|
|
| 161 |
generate_script_button.click(
|
| 162 |
fn=step_generate_script,
|
| 163 |
inputs=[user_prompt, llama_model_id, duration],
|
| 164 |
+
outputs=[script_output, music_suggestion_output],
|
| 165 |
)
|
| 166 |
|
| 167 |
generate_voice_button.click(
|
|
|
|
| 172 |
|
| 173 |
generate_music_button.click(
|
| 174 |
fn=step_generate_music,
|
| 175 |
+
inputs=[music_suggestion_output, audio_length],
|
| 176 |
outputs=[music_output],
|
| 177 |
)
|
| 178 |
|