Spaces:
Sleeping
Sleeping
improve layout
Browse files
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.
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|