youngtsai commited on
Commit
ead5196
·
1 Parent(s): c1815bc

with gr.Column(scale=2):

Browse files
Files changed (1) hide show
  1. app.py +17 -14
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.Row():
60
- password_input = gr.Textbox(label="Password", type="password")
61
- with gr.Row():
62
- audio_input = gr.Audio(sources=["microphone","upload"], type="filepath", max_length=60, label="語音輸入")
63
- api_plan_input = gr.Dropdown(choices=["basic", "premium"], label="API Plan")
64
- return_json_input = gr.Checkbox(label="Return JSON", value=True)
65
- submit_button = gr.Button("Score Audio")
66
- output_text = gr.JSON(label="API Response")
67
-
68
- submit_button.click(
69
- fn=score_audio_plus,
70
- inputs=[password_input, audio_input, api_plan_input, return_json_input],
71
- outputs=output_text
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()