akki2825 commited on
Commit
0115245
·
verified ·
1 Parent(s): dd10290

improve layout

Browse files
Files changed (1) hide show
  1. app.py +40 -16
app.py CHANGED
@@ -258,20 +258,45 @@ def process_and_display(ref_file, hyp_file):
258
 
259
  def main():
260
  with gr.Blocks() as demo:
261
- gr.Markdown("# ASR Metrics")
262
-
263
- with gr.Row():
264
- reference_file = gr.File(label="Upload Reference File")
265
- hypothesis_file = gr.File(label="Upload Model Output File")
266
-
267
- with gr.Row():
268
- reference_preview = gr.Textbox(label="Reference Preview", lines=3)
269
- hypothesis_preview = gr.Textbox(label="Hypothesis Preview", lines=3)
270
-
271
- with gr.Row():
272
- compute_button = gr.Button("Compute Metrics")
273
- results_output = gr.JSON(label="Results")
274
- metrics_output = gr.Markdown(label="Metrics")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
 
276
  # Update previews when files are uploaded
277
  def update_previews(ref_file, hyp_file):
@@ -301,11 +326,10 @@ def main():
301
  compute_button.click(
302
  fn=process_and_display,
303
  inputs=[reference_file, hypothesis_file],
304
- outputs=[results_output, metrics_output]
305
  )
306
 
307
  demo.launch()
308
 
309
-
310
  if __name__ == "__main__":
311
  main()
 
258
 
259
  def main():
260
  with gr.Blocks() as demo:
261
+ gr.Markdown("# ASR Metrics Analysis")
262
+
263
+ with gr.Columns() as cols:
264
+ with gr.Column():
265
+ gr.Markdown("### Instructions")
266
+ gr.Markdown("* Upload your reference and hypothesis files")
267
+ gr.Markdown("* The interface will automatically analyze and display metrics")
268
+ gr.Markdown("* Results include overall metrics, sentence-level metrics, and misaligned sentences")
269
+
270
+ with gr.Column():
271
+ with gr.Row():
272
+ reference_file = gr.File(label="Upload Reference File")
273
+ hypothesis_file = gr.File(label="Upload Model Output File")
274
+
275
+ with gr.Row():
276
+ reference_preview = gr.Textbox(label="Reference Preview", lines=3)
277
+ hypothesis_preview = gr.Textbox(label="Hypothesis Preview", lines=3)
278
+
279
+ with gr.Row():
280
+ compute_button = gr.Button("Compute Metrics", variant="primary")
281
+ results_output = gr.JSON(label="Results", visible=False)
282
+ metrics_output = gr.Markdown(label="Metrics")
283
+ misaligned_output = gr.Markdown(label="Misaligned Sentences")
284
+
285
+ gr.Markdown("---")
286
+ gr.Markdown("### Results")
287
+
288
+ with gr.Columns() as results_cols:
289
+ with gr.Column():
290
+ gr.Markdown("#### Overall Metrics")
291
+ gr.JSON(label="Results", source="results_output")
292
+
293
+ with gr.Column():
294
+ gr.Markdown("#### Sentence-level Metrics")
295
+ gr.Markdown(label="Metrics", source="metrics_output")
296
+
297
+ with gr.Column():
298
+ gr.Markdown("#### Misaligned Sentences")
299
+ gr.Markdown(label="Misaligned Sentences", source="misaligned_output")
300
 
301
  # Update previews when files are uploaded
302
  def update_previews(ref_file, hyp_file):
 
326
  compute_button.click(
327
  fn=process_and_display,
328
  inputs=[reference_file, hypothesis_file],
329
+ outputs=[results_output, metrics_output, misaligned_output]
330
  )
331
 
332
  demo.launch()
333
 
 
334
  if __name__ == "__main__":
335
  main()