Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -182,7 +182,7 @@ def create_gradio_interface():
|
|
| 182 |
answer_output = gr.Textbox(label="Answer", interactive=False)
|
| 183 |
|
| 184 |
with gr.Tab("🗣️ Generate Audio and Text"):
|
| 185 |
-
text_input = gr.Textbox(label="Enter text for generation")
|
| 186 |
voice_type = gr.Dropdown(
|
| 187 |
choices=["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
|
| 188 |
label="Voice Type",
|
|
@@ -194,27 +194,15 @@ def create_gradio_interface():
|
|
| 194 |
value=1.0,
|
| 195 |
label="Voice Speed"
|
| 196 |
)
|
| 197 |
-
language = gr.Dropdown(
|
| 198 |
-
choices=["en", "ar", "de", "hi", "es", "fr", "it", "ja", "ko", "pt"],
|
| 199 |
-
label="Language",
|
| 200 |
-
value="en"
|
| 201 |
-
)
|
| 202 |
output_option = gr.Radio(
|
| 203 |
-
choices=["audio", "
|
| 204 |
label="Output Option",
|
| 205 |
value="both"
|
| 206 |
)
|
| 207 |
-
summary_length = gr.Slider(
|
| 208 |
-
minimum=50,
|
| 209 |
-
maximum=500,
|
| 210 |
-
value=100,
|
| 211 |
-
step=10,
|
| 212 |
-
label="Summary Length (words)"
|
| 213 |
-
)
|
| 214 |
-
additional_prompt = gr.Textbox(label="Additional Prompt (Optional)")
|
| 215 |
generate_button = gr.Button("Generate")
|
| 216 |
audio_output = gr.Audio(label="Generated Audio")
|
| 217 |
-
|
|
|
|
| 218 |
|
| 219 |
# Wire up the components
|
| 220 |
upload_button.click(
|
|
@@ -229,9 +217,8 @@ def create_gradio_interface():
|
|
| 229 |
outputs=[answer_output]
|
| 230 |
)
|
| 231 |
|
| 232 |
-
# Automatically paste the answer into the "Enter text for generation" text box
|
| 233 |
answer_output.change(
|
| 234 |
-
fn=lambda ans: ans,
|
| 235 |
inputs=[answer_output],
|
| 236 |
outputs=[text_input]
|
| 237 |
)
|
|
@@ -240,10 +227,9 @@ def create_gradio_interface():
|
|
| 240 |
fn=generate_audio_and_text,
|
| 241 |
inputs=[
|
| 242 |
api_key_input, text_input, model_dropdown, voice_type,
|
| 243 |
-
voice_speed,
|
| 244 |
-
additional_prompt
|
| 245 |
],
|
| 246 |
-
outputs=[audio_output,
|
| 247 |
)
|
| 248 |
|
| 249 |
return demo
|
|
|
|
| 182 |
answer_output = gr.Textbox(label="Answer", interactive=False)
|
| 183 |
|
| 184 |
with gr.Tab("🗣️ Generate Audio and Text"):
|
| 185 |
+
text_input = gr.Textbox(label="Enter text for generation")
|
| 186 |
voice_type = gr.Dropdown(
|
| 187 |
choices=["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
|
| 188 |
label="Voice Type",
|
|
|
|
| 194 |
value=1.0,
|
| 195 |
label="Voice Speed"
|
| 196 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
output_option = gr.Radio(
|
| 198 |
+
choices=["audio", "script_text", "both"],
|
| 199 |
label="Output Option",
|
| 200 |
value="both"
|
| 201 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
generate_button = gr.Button("Generate")
|
| 203 |
audio_output = gr.Audio(label="Generated Audio")
|
| 204 |
+
script_output = gr.File(label="Script Text File")
|
| 205 |
+
status_output = gr.Textbox(label="Status", interactive=False)
|
| 206 |
|
| 207 |
# Wire up the components
|
| 208 |
upload_button.click(
|
|
|
|
| 217 |
outputs=[answer_output]
|
| 218 |
)
|
| 219 |
|
|
|
|
| 220 |
answer_output.change(
|
| 221 |
+
fn=lambda ans: ans,
|
| 222 |
inputs=[answer_output],
|
| 223 |
outputs=[text_input]
|
| 224 |
)
|
|
|
|
| 227 |
fn=generate_audio_and_text,
|
| 228 |
inputs=[
|
| 229 |
api_key_input, text_input, model_dropdown, voice_type,
|
| 230 |
+
voice_speed, output_option
|
|
|
|
| 231 |
],
|
| 232 |
+
outputs=[audio_output, script_output, status_output]
|
| 233 |
)
|
| 234 |
|
| 235 |
return demo
|