Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Change the citation accordion label depending on the selected language
Browse files
app.py
CHANGED
|
@@ -605,6 +605,10 @@ with gr.Blocks() as demo_submission:
|
|
| 605 |
# Main demo
|
| 606 |
|
| 607 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
def set_default_language(request: gr.Request) -> gr.Radio:
|
| 609 |
if request.headers["Accept-Language"].split(",")[0].lower().startswith("ja"):
|
| 610 |
return gr.Radio(value="π―π΅ JA")
|
|
@@ -622,6 +626,7 @@ def update_language(
|
|
| 622 |
gr.Button,
|
| 623 |
gr.Button,
|
| 624 |
gr.Button,
|
|
|
|
| 625 |
]:
|
| 626 |
if language == "π―π΅ JA":
|
| 627 |
return (
|
|
@@ -632,6 +637,7 @@ def update_language(
|
|
| 632 |
gr.Button(value=SELECT_ALL_BUTTON_LABEL_JA),
|
| 633 |
gr.Button(value=SELECT_NONE_BUTTON_LABEL_JA),
|
| 634 |
gr.Button(value=SELECT_AVG_ONLY_BUTTON_LABEL_JA),
|
|
|
|
| 635 |
)
|
| 636 |
else:
|
| 637 |
return (
|
|
@@ -642,6 +648,7 @@ def update_language(
|
|
| 642 |
gr.Button(value=SELECT_ALL_BUTTON_LABEL),
|
| 643 |
gr.Button(value=SELECT_NONE_BUTTON_LABEL),
|
| 644 |
gr.Button(value=SELECT_AVG_ONLY_BUTTON_LABEL),
|
|
|
|
| 645 |
)
|
| 646 |
|
| 647 |
|
|
@@ -660,7 +667,7 @@ with gr.Blocks(css_paths="style.css", theme=gr.themes.Glass()) as demo:
|
|
| 660 |
demo_submission.render()
|
| 661 |
|
| 662 |
with gr.Row():
|
| 663 |
-
with gr.Accordion(
|
| 664 |
citation_button = gr.Textbox(
|
| 665 |
label=CITATION_BUTTON_LABEL_JA,
|
| 666 |
value=CITATION_BUTTON_TEXT,
|
|
@@ -690,6 +697,7 @@ with gr.Blocks(css_paths="style.css", theme=gr.themes.Glass()) as demo:
|
|
| 690 |
select_all_button,
|
| 691 |
select_none_button,
|
| 692 |
select_avg_only_button,
|
|
|
|
| 693 |
],
|
| 694 |
api_name=False,
|
| 695 |
)
|
|
|
|
| 605 |
# Main demo
|
| 606 |
|
| 607 |
|
| 608 |
+
CITATION_ACCORDION_LABEL = "π Citation"
|
| 609 |
+
CITATION_ACCORDION_LABEL_JA = "π εΌη¨"
|
| 610 |
+
|
| 611 |
+
|
| 612 |
def set_default_language(request: gr.Request) -> gr.Radio:
|
| 613 |
if request.headers["Accept-Language"].split(",")[0].lower().startswith("ja"):
|
| 614 |
return gr.Radio(value="π―π΅ JA")
|
|
|
|
| 626 |
gr.Button,
|
| 627 |
gr.Button,
|
| 628 |
gr.Button,
|
| 629 |
+
gr.Accordion,
|
| 630 |
]:
|
| 631 |
if language == "π―π΅ JA":
|
| 632 |
return (
|
|
|
|
| 637 |
gr.Button(value=SELECT_ALL_BUTTON_LABEL_JA),
|
| 638 |
gr.Button(value=SELECT_NONE_BUTTON_LABEL_JA),
|
| 639 |
gr.Button(value=SELECT_AVG_ONLY_BUTTON_LABEL_JA),
|
| 640 |
+
gr.Accordion(label=CITATION_ACCORDION_LABEL_JA),
|
| 641 |
)
|
| 642 |
else:
|
| 643 |
return (
|
|
|
|
| 648 |
gr.Button(value=SELECT_ALL_BUTTON_LABEL),
|
| 649 |
gr.Button(value=SELECT_NONE_BUTTON_LABEL),
|
| 650 |
gr.Button(value=SELECT_AVG_ONLY_BUTTON_LABEL),
|
| 651 |
+
gr.Accordion(label=CITATION_ACCORDION_LABEL),
|
| 652 |
)
|
| 653 |
|
| 654 |
|
|
|
|
| 667 |
demo_submission.render()
|
| 668 |
|
| 669 |
with gr.Row():
|
| 670 |
+
with gr.Accordion(CITATION_ACCORDION_LABEL_JA, open=False) as citation_accordion:
|
| 671 |
citation_button = gr.Textbox(
|
| 672 |
label=CITATION_BUTTON_LABEL_JA,
|
| 673 |
value=CITATION_BUTTON_TEXT,
|
|
|
|
| 697 |
select_all_button,
|
| 698 |
select_none_button,
|
| 699 |
select_avg_only_button,
|
| 700 |
+
citation_accordion,
|
| 701 |
],
|
| 702 |
api_name=False,
|
| 703 |
)
|