Update app.py
Browse files
app.py
CHANGED
|
@@ -536,47 +536,50 @@ with gr.Blocks(title=TITLE) as demo:
|
|
| 536 |
"Add rows where **Original Tag** will be replaced by **Substitute Tag** "
|
| 537 |
"in the final combined output (after all frames are processed)."
|
| 538 |
)
|
| 539 |
-
|
| 540 |
-
with
|
|
|
|
| 541 |
tag_substitutes_df = gr.Dataframe(
|
| 542 |
headers=["Original Tag", "Substitute Tag"],
|
| 543 |
datatype=["str", "str"],
|
| 544 |
-
row_count=1,
|
| 545 |
column_count=2,
|
| 546 |
type="array",
|
| 547 |
label="Tag Substitutes",
|
| 548 |
interactive=True,
|
| 549 |
)
|
| 550 |
-
|
| 551 |
-
|
| 552 |
gr.Markdown("### Tag Exclusions")
|
| 553 |
gr.Markdown(
|
| 554 |
"Add tags that should be **removed entirely** from the final combined output."
|
| 555 |
)
|
| 556 |
-
|
| 557 |
-
with
|
|
|
|
| 558 |
tag_exclusions_df = gr.Dataframe(
|
| 559 |
headers=["Tag to Exclude"],
|
| 560 |
datatype=["str"],
|
| 561 |
-
row_count=1,
|
| 562 |
column_count=1,
|
| 563 |
type="array",
|
| 564 |
label="Tag Exclusions",
|
| 565 |
interactive=True,
|
| 566 |
)
|
| 567 |
-
|
| 568 |
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
|
|
|
| 574 |
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
|
| 581 |
|
| 582 |
# Wiring the button AFTER all components are defined
|
|
|
|
| 536 |
"Add rows where **Original Tag** will be replaced by **Substitute Tag** "
|
| 537 |
"in the final combined output (after all frames are processed)."
|
| 538 |
)
|
| 539 |
+
|
| 540 |
+
# Dataframe with button *below* it
|
| 541 |
+
with gr.Column():
|
| 542 |
tag_substitutes_df = gr.Dataframe(
|
| 543 |
headers=["Original Tag", "Substitute Tag"],
|
| 544 |
datatype=["str", "str"],
|
| 545 |
+
row_count=1,
|
| 546 |
column_count=2,
|
| 547 |
type="array",
|
| 548 |
label="Tag Substitutes",
|
| 549 |
interactive=True,
|
| 550 |
)
|
| 551 |
+
add_sub_row_btn = gr.Button("β Add substitute")
|
| 552 |
+
|
| 553 |
gr.Markdown("### Tag Exclusions")
|
| 554 |
gr.Markdown(
|
| 555 |
"Add tags that should be **removed entirely** from the final combined output."
|
| 556 |
)
|
| 557 |
+
|
| 558 |
+
# Dataframe with button *below* it
|
| 559 |
+
with gr.Column():
|
| 560 |
tag_exclusions_df = gr.Dataframe(
|
| 561 |
headers=["Tag to Exclude"],
|
| 562 |
datatype=["str"],
|
| 563 |
+
row_count=1,
|
| 564 |
column_count=1,
|
| 565 |
type="array",
|
| 566 |
label="Tag Exclusions",
|
| 567 |
interactive=True,
|
| 568 |
)
|
| 569 |
+
add_ex_row_btn = gr.Button("β Add exclusion")
|
| 570 |
|
| 571 |
+
|
| 572 |
+
add_sub_row_btn.click(
|
| 573 |
+
fn=add_substitute_row,
|
| 574 |
+
inputs=tag_substitutes_df,
|
| 575 |
+
outputs=tag_substitutes_df,
|
| 576 |
+
)
|
| 577 |
|
| 578 |
+
add_ex_row_btn.click(
|
| 579 |
+
fn=add_exclusion_row,
|
| 580 |
+
inputs=tag_exclusions_df,
|
| 581 |
+
outputs=tag_exclusions_df,
|
| 582 |
+
)
|
| 583 |
|
| 584 |
|
| 585 |
# Wiring the button AFTER all components are defined
|