input_audio = gr.Audio(
Browse files
app.py
CHANGED
|
@@ -32,18 +32,27 @@ def score_audio_plus(audio, api_plan, return_json):
|
|
| 32 |
# Error handling
|
| 33 |
return f"Error: {response.status_code} - {response.text}"
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
# Launch the interface
|
| 49 |
-
|
|
|
|
| 32 |
# Error handling
|
| 33 |
return f"Error: {response.status_code} - {response.text}"
|
| 34 |
|
| 35 |
+
with gr.Blocks() as blocks:
|
| 36 |
+
with gr.Row():
|
| 37 |
+
input_audio = gr.Audio(
|
| 38 |
+
sources=["microphone"],
|
| 39 |
+
waveform_options=gr.WaveformOptions(
|
| 40 |
+
waveform_color="#01C6FF",
|
| 41 |
+
waveform_progress_color="#0066B4",
|
| 42 |
+
skip_length=2,
|
| 43 |
+
show_controls=False,
|
| 44 |
+
),
|
| 45 |
+
)
|
| 46 |
+
api_plan = gr.Dropdown(choices=["basic", "premium"], label="API Plan")
|
| 47 |
+
return_json = gr.Checkbox(label="Return JSON", value=True)
|
| 48 |
+
submit_button = gr.Button("Score Audio")
|
| 49 |
+
output_text = gr.Textbox(label="API Response")
|
| 50 |
+
|
| 51 |
+
submit_button.click(
|
| 52 |
+
fn=score_audio_plus,
|
| 53 |
+
inputs=[input_audio, api_plan, return_json],
|
| 54 |
+
outputs=output_text
|
| 55 |
+
)
|
| 56 |
|
| 57 |
+
# Launch the interface in blocking mode
|
| 58 |
+
blocks.launch()
|