with gr.Column(scale=2):
Browse files
app.py
CHANGED
|
@@ -56,20 +56,23 @@ def score_audio_plus(password, audio, api_plan, return_json):
|
|
| 56 |
return f"Error: {response.status_code} - {response.text}"
|
| 57 |
|
| 58 |
with gr.Blocks() as demo:
|
| 59 |
-
with gr.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
# Launch the interface
|
| 75 |
demo.launch()
|
|
|
|
| 56 |
return f"Error: {response.status_code} - {response.text}"
|
| 57 |
|
| 58 |
with gr.Blocks() as demo:
|
| 59 |
+
with gr.Tab("score_audio_plus"):
|
| 60 |
+
with gr.Row():
|
| 61 |
+
password_input = gr.Textbox(label="Password", type="password")
|
| 62 |
+
with gr.Row():
|
| 63 |
+
with gr.Column(scale=2):
|
| 64 |
+
audio_input = gr.Audio(sources=["microphone","upload"], type="filepath", max_length=60, label="語音輸入")
|
| 65 |
+
api_plan_input = gr.Dropdown(choices=["basic", "premium"], label="API Plan", value="premium")
|
| 66 |
+
return_json_input = gr.Checkbox(label="Return JSON", value=True)
|
| 67 |
+
submit_button = gr.Button("Score Audio")
|
| 68 |
+
with gr.Column(scale=1):
|
| 69 |
+
output_text = gr.JSON(label="API Response")
|
| 70 |
+
|
| 71 |
+
submit_button.click(
|
| 72 |
+
fn=score_audio_plus,
|
| 73 |
+
inputs=[password_input, audio_input, api_plan_input, return_json_input],
|
| 74 |
+
outputs=output_text
|
| 75 |
+
)
|
| 76 |
|
| 77 |
# Launch the interface
|
| 78 |
demo.launch()
|