Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,6 @@ hf_token = os.getenv("HF_TOKEN")
|
|
24 |
# Script Generation Function
|
25 |
# ---------------------------------------------------------------------
|
26 |
@spaces.GPU(duration=300)
|
27 |
-
@spaces.GPU(duration=300)
|
28 |
def generate_script(user_prompt: str, model_id: str, token: str, duration: int):
|
29 |
try:
|
30 |
tokenizer = AutoTokenizer.from_pretrained(model_id, use_auth_token=token)
|
@@ -145,12 +144,13 @@ with gr.Blocks() as demo:
|
|
145 |
|
146 |
generate_script_button = gr.Button("Generate Script")
|
147 |
script_output = gr.Textbox(label="Generated Script")
|
|
|
148 |
music_suggestion_output = gr.Textbox(label="Music Suggestion")
|
149 |
|
150 |
generate_script_button.click(
|
151 |
-
fn=
|
152 |
-
inputs=[user_prompt, llama_model_id, duration],
|
153 |
-
outputs=[script_output, music_suggestion_output],
|
154 |
)
|
155 |
|
156 |
with gr.Tab("Step 2: Generate Voice"):
|
@@ -161,7 +161,7 @@ with gr.Blocks() as demo:
|
|
161 |
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
162 |
|
163 |
generate_voice_button.click(
|
164 |
-
fn=
|
165 |
inputs=[script_output, speaker],
|
166 |
outputs=[voice_output],
|
167 |
)
|
@@ -174,7 +174,7 @@ with gr.Blocks() as demo:
|
|
174 |
music_output = gr.Audio(label="Generated Music", type="filepath")
|
175 |
|
176 |
generate_music_button.click(
|
177 |
-
fn=
|
178 |
inputs=[music_suggestion_output, audio_length],
|
179 |
outputs=[music_output],
|
180 |
)
|
@@ -187,7 +187,7 @@ with gr.Blocks() as demo:
|
|
187 |
final_output = gr.Audio(label="Final Promo Audio", type="filepath")
|
188 |
|
189 |
blend_button.click(
|
190 |
-
fn=
|
191 |
inputs=[voice_output, music_output, ducking],
|
192 |
outputs=[final_output],
|
193 |
)
|
@@ -199,4 +199,4 @@ with gr.Blocks() as demo:
|
|
199 |
</p>
|
200 |
""")
|
201 |
|
202 |
-
demo.launch(debug=True)
|
|
|
24 |
# Script Generation Function
|
25 |
# ---------------------------------------------------------------------
|
26 |
@spaces.GPU(duration=300)
|
|
|
27 |
def generate_script(user_prompt: str, model_id: str, token: str, duration: int):
|
28 |
try:
|
29 |
tokenizer = AutoTokenizer.from_pretrained(model_id, use_auth_token=token)
|
|
|
144 |
|
145 |
generate_script_button = gr.Button("Generate Script")
|
146 |
script_output = gr.Textbox(label="Generated Script")
|
147 |
+
sound_design_output = gr.Textbox(label="Sound Design")
|
148 |
music_suggestion_output = gr.Textbox(label="Music Suggestion")
|
149 |
|
150 |
generate_script_button.click(
|
151 |
+
fn=generate_script,
|
152 |
+
inputs=[user_prompt, llama_model_id, hf_token, duration],
|
153 |
+
outputs=[script_output, sound_design_output, music_suggestion_output],
|
154 |
)
|
155 |
|
156 |
with gr.Tab("Step 2: Generate Voice"):
|
|
|
161 |
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
162 |
|
163 |
generate_voice_button.click(
|
164 |
+
fn=generate_voice,
|
165 |
inputs=[script_output, speaker],
|
166 |
outputs=[voice_output],
|
167 |
)
|
|
|
174 |
music_output = gr.Audio(label="Generated Music", type="filepath")
|
175 |
|
176 |
generate_music_button.click(
|
177 |
+
fn=generate_music,
|
178 |
inputs=[music_suggestion_output, audio_length],
|
179 |
outputs=[music_output],
|
180 |
)
|
|
|
187 |
final_output = gr.Audio(label="Final Promo Audio", type="filepath")
|
188 |
|
189 |
blend_button.click(
|
190 |
+
fn=blend_audio,
|
191 |
inputs=[voice_output, music_output, ducking],
|
192 |
outputs=[final_output],
|
193 |
)
|
|
|
199 |
</p>
|
200 |
""")
|
201 |
|
202 |
+
demo.launch(debug=True)
|