Spaces:
Runtime error
Runtime error
pt -> en
Browse files
app.py
CHANGED
@@ -399,11 +399,11 @@ if __name__ == "__main__":
|
|
399 |
with gr.Blocks() as demo:
|
400 |
with gr.Row():
|
401 |
with gr.Column(scale=1, min_width=300):
|
402 |
-
gr.Markdown("###
|
403 |
with gr.Row():
|
404 |
with gr.Column(scale=1, min_width=300):
|
405 |
dropdown = gr.Dropdown(
|
406 |
-
label="
|
407 |
choices=[
|
408 |
"SumyRandom",
|
409 |
"SumyLuhn",
|
@@ -422,70 +422,70 @@ if __name__ == "__main__":
|
|
422 |
)
|
423 |
with gr.Column(scale=1, min_width=300):
|
424 |
compression_ratio = gr.Slider(
|
425 |
-
label="
|
426 |
value=10,
|
427 |
minimum=1,
|
428 |
maximum=100,
|
429 |
)
|
430 |
-
use_golden = gr.Checkbox(label="
|
431 |
-
with gr.Tab("
|
432 |
with gr.Row():
|
433 |
with gr.Column(scale=1, min_width=300):
|
434 |
text = gr.Textbox(
|
435 |
-
label="
|
436 |
-
placeholder="
|
437 |
)
|
438 |
golden = gr.Textbox(
|
439 |
label="Golden Summary",
|
440 |
-
placeholder="
|
441 |
)
|
442 |
with gr.Column(scale=1, min_width=300):
|
443 |
-
generated_summary = gr.Textbox(label="
|
444 |
-
evaluators = gr.Textbox(label="
|
445 |
-
text_button = gr.Button("
|
446 |
with gr.Tab("CSV"):
|
447 |
with gr.Column(scale=1, min_width=300):
|
448 |
gr.Checkbox(
|
449 |
-
label="
|
450 |
value=False,
|
451 |
interactive=False,
|
452 |
)
|
453 |
with gr.Row():
|
454 |
with gr.Column(scale=1, min_width=300):
|
455 |
with gr.Row():
|
456 |
-
text_column = gr.Textbox(label="
|
457 |
-
golden_column = gr.Textbox(label="
|
458 |
n_csv = gr.Number(
|
459 |
-
label="
|
460 |
precision=0,
|
461 |
value=30,
|
462 |
interactive=True,
|
463 |
)
|
464 |
-
csv_input = gr.File(label="
|
465 |
with gr.Column(scale=1, min_width=300):
|
466 |
-
csv_output = gr.Files(label="
|
467 |
-
csv_evaluators = gr.Textbox(label="
|
468 |
-
csv_button = gr.Button("
|
469 |
with gr.Tab("DataFrame"):
|
470 |
with gr.Column(scale=1, min_width=300):
|
471 |
gr.Checkbox(
|
472 |
-
label="
|
473 |
value=False,
|
474 |
interactive=False,
|
475 |
)
|
476 |
with gr.Row():
|
477 |
with gr.Column(scale=1, min_width=300):
|
478 |
n_df = gr.Number(
|
479 |
-
label="
|
480 |
precision=0,
|
481 |
value=5,
|
482 |
interactive=True,
|
483 |
)
|
484 |
df_input = gr.DataFrame(headers=["Texto", "Golden Summary"], row_count=(1, "dynamic"), col_count=(2, "fixed"))
|
485 |
with gr.Column(scale=1, min_width=300):
|
486 |
-
df_output = gr.Files(label="
|
487 |
-
df_evaluators = gr.Textbox(label="
|
488 |
-
df_button = gr.Button("
|
489 |
|
490 |
text_button.click(run, inputs=[dropdown, text, compression_ratio, use_golden, golden], outputs=[generated_summary, evaluators])
|
491 |
csv_button.click(run_csv, inputs=[dropdown, csv_input, text_column, n_csv, golden_column, compression_ratio, use_golden], outputs=[csv_output, csv_evaluators])
|
|
|
399 |
with gr.Blocks() as demo:
|
400 |
with gr.Row():
|
401 |
with gr.Column(scale=1, min_width=300):
|
402 |
+
gr.Markdown("### Automatic Text Summarization + Summary Evaluation\n Data Science Research Project Applied to the Portfolio of Financial Products (PPF-MCTI)")
|
403 |
with gr.Row():
|
404 |
with gr.Column(scale=1, min_width=300):
|
405 |
dropdown = gr.Dropdown(
|
406 |
+
label="Summarization Method",
|
407 |
choices=[
|
408 |
"SumyRandom",
|
409 |
"SumyLuhn",
|
|
|
422 |
)
|
423 |
with gr.Column(scale=1, min_width=300):
|
424 |
compression_ratio = gr.Slider(
|
425 |
+
label="Compression Rate (% of original length)",
|
426 |
value=10,
|
427 |
minimum=1,
|
428 |
maximum=100,
|
429 |
)
|
430 |
+
use_golden = gr.Checkbox(label="Evaluate using Golden Summary?")
|
431 |
+
with gr.Tab("Text"):
|
432 |
with gr.Row():
|
433 |
with gr.Column(scale=1, min_width=300):
|
434 |
text = gr.Textbox(
|
435 |
+
label="Text",
|
436 |
+
placeholder="Insert text here",
|
437 |
)
|
438 |
golden = gr.Textbox(
|
439 |
label="Golden Summary",
|
440 |
+
placeholder="Insert Golden Summary here (optional)",
|
441 |
)
|
442 |
with gr.Column(scale=1, min_width=300):
|
443 |
+
generated_summary = gr.Textbox(label="Automatically generated summary")
|
444 |
+
evaluators = gr.Textbox(label="Summary evaluation")
|
445 |
+
text_button = gr.Button("Run")
|
446 |
with gr.Tab("CSV"):
|
447 |
with gr.Column(scale=1, min_width=300):
|
448 |
gr.Checkbox(
|
449 |
+
label="Upload a .csv file below with a column containing texts to be summarized. Golden summaries should be in a different column, if any",
|
450 |
value=False,
|
451 |
interactive=False,
|
452 |
)
|
453 |
with gr.Row():
|
454 |
with gr.Column(scale=1, min_width=300):
|
455 |
with gr.Row():
|
456 |
+
text_column = gr.Textbox(label="Texts column title", placeholder="text")
|
457 |
+
golden_column = gr.Textbox(label="Golden Summaries column title (optional)", placeholder="golden")
|
458 |
n_csv = gr.Number(
|
459 |
+
label="Number of summaries to be evaluated (0 = All)",
|
460 |
precision=0,
|
461 |
value=30,
|
462 |
interactive=True,
|
463 |
)
|
464 |
+
csv_input = gr.File(label=".csv file with texts")
|
465 |
with gr.Column(scale=1, min_width=300):
|
466 |
+
csv_output = gr.Files(label=".csv file with summaries")
|
467 |
+
csv_evaluators = gr.Textbox(label="Summary evaluation (average)")
|
468 |
+
csv_button = gr.Button("Run")
|
469 |
with gr.Tab("DataFrame"):
|
470 |
with gr.Column(scale=1, min_width=300):
|
471 |
gr.Checkbox(
|
472 |
+
label="Add texts and golden summaries (optional) to the DataFrame below.",
|
473 |
value=False,
|
474 |
interactive=False,
|
475 |
)
|
476 |
with gr.Row():
|
477 |
with gr.Column(scale=1, min_width=300):
|
478 |
n_df = gr.Number(
|
479 |
+
label="Number of summaries to be evaluated (0 = All)",
|
480 |
precision=0,
|
481 |
value=5,
|
482 |
interactive=True,
|
483 |
)
|
484 |
df_input = gr.DataFrame(headers=["Texto", "Golden Summary"], row_count=(1, "dynamic"), col_count=(2, "fixed"))
|
485 |
with gr.Column(scale=1, min_width=300):
|
486 |
+
df_output = gr.Files(label=".csv file with summaries")
|
487 |
+
df_evaluators = gr.Textbox(label="Summary evaluation (average)")
|
488 |
+
df_button = gr.Button("Run")
|
489 |
|
490 |
text_button.click(run, inputs=[dropdown, text, compression_ratio, use_golden, golden], outputs=[generated_summary, evaluators])
|
491 |
csv_button.click(run_csv, inputs=[dropdown, csv_input, text_column, n_csv, golden_column, compression_ratio, use_golden], outputs=[csv_output, csv_evaluators])
|