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