Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -135,62 +135,66 @@ with gr.Blocks() as demo:
|
|
135 |
Generate and mix radio promos effortlessly with AI tools!
|
136 |
""")
|
137 |
|
|
|
|
|
138 |
with gr.Tab("Step 1: Generate Script"):
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
194 |
|
195 |
gr.Markdown("""
|
196 |
<hr>
|
|
|
135 |
Generate and mix radio promos effortlessly with AI tools!
|
136 |
""")
|
137 |
|
138 |
+
with gr.Tabs():
|
139 |
+
# Step 1: Generate Script
|
140 |
with gr.Tab("Step 1: Generate Script"):
|
141 |
+
with gr.Row():
|
142 |
+
user_prompt = gr.Textbox(label="Promo Idea", placeholder="E.g., A 30-second promo for a morning show.")
|
143 |
+
llama_model_id = gr.Textbox(label="Llama Model ID", value="meta-llama/Meta-Llama-3-8B-Instruct")
|
144 |
+
duration = gr.Slider(label="Duration (seconds)", minimum=15, maximum=60, step=15, value=30)
|
145 |
+
|
146 |
+
generate_script_button = gr.Button("Generate Script")
|
147 |
+
script_output = gr.Textbox(label="Generated Script", lines=5)
|
148 |
+
sound_design_output = gr.Textbox(label="Sound Design", lines=3)
|
149 |
+
music_suggestion_output = gr.Textbox(label="Music Suggestions", lines=3)
|
150 |
+
|
151 |
+
generate_script_button.click(
|
152 |
+
fn=lambda user_prompt, model_id, duration: generate_script(user_prompt, model_id, hf_token, duration),
|
153 |
+
inputs=[user_prompt, llama_model_id, duration],
|
154 |
+
outputs=[script_output, sound_design_output, music_suggestion_output],
|
155 |
+
)
|
156 |
+
|
157 |
+
# Step 2: Generate Voice
|
158 |
+
with gr.Tab("Step 2: Generate Voice"):
|
159 |
+
with gr.Row():
|
160 |
+
speaker = gr.Textbox(label="Voice Style (optional)", placeholder="E.g., male, female, or neutral.")
|
161 |
+
|
162 |
+
generate_voice_button = gr.Button("Generate Voice")
|
163 |
+
voice_output = gr.Audio(label="Generated Voice", type="filepath")
|
164 |
+
|
165 |
+
generate_voice_button.click(
|
166 |
+
fn=generate_voice,
|
167 |
+
inputs=[script_output, speaker],
|
168 |
+
outputs=[voice_output],
|
169 |
+
)
|
170 |
+
|
171 |
+
# Step 3: Generate Music
|
172 |
+
with gr.Tab("Step 3: Generate Music"):
|
173 |
+
with gr.Row():
|
174 |
+
audio_length = gr.Slider(label="Music Length (tokens)", minimum=128, maximum=1024, step=64, value=512)
|
175 |
+
|
176 |
+
generate_music_button = gr.Button("Generate Music")
|
177 |
+
music_output = gr.Audio(label="Generated Music", type="filepath")
|
178 |
+
|
179 |
+
generate_music_button.click(
|
180 |
+
fn=generate_music,
|
181 |
+
inputs=[music_suggestion_output, audio_length],
|
182 |
+
outputs=[music_output],
|
183 |
+
)
|
184 |
+
|
185 |
+
# Step 4: Blend Audio
|
186 |
+
with gr.Tab("Step 4: Blend Audio"):
|
187 |
+
with gr.Row():
|
188 |
+
ducking = gr.Checkbox(label="Enable Ducking", value=True)
|
189 |
+
|
190 |
+
blend_button = gr.Button("Blend Audio")
|
191 |
+
final_output = gr.Audio(label="Final Promo Audio", type="filepath")
|
192 |
+
|
193 |
+
blend_button.click(
|
194 |
+
fn=blend_audio,
|
195 |
+
inputs=[voice_output, music_output, ducking],
|
196 |
+
outputs=[final_output],
|
197 |
+
)
|
198 |
|
199 |
gr.Markdown("""
|
200 |
<hr>
|