Use dropdown for language selection
Browse files
app.py
CHANGED
|
@@ -509,11 +509,12 @@ def update_language(language: str) -> gr.Markdown:
|
|
| 509 |
|
| 510 |
with gr.Blocks(css=custom_css, css_paths="style.css", theme=gr.themes.Base()) as demo:
|
| 511 |
with gr.Row(elem_classes="language-switch-container"):
|
| 512 |
-
language = gr.
|
| 513 |
choices=["π―π΅ JP", "πΊπΈ EN"],
|
| 514 |
value="π―π΅ JP",
|
| 515 |
-
elem_classes="language-
|
| 516 |
show_label=False,
|
|
|
|
| 517 |
)
|
| 518 |
|
| 519 |
gr.HTML(TITLE)
|
|
|
|
| 509 |
|
| 510 |
with gr.Blocks(css=custom_css, css_paths="style.css", theme=gr.themes.Base()) as demo:
|
| 511 |
with gr.Row(elem_classes="language-switch-container"):
|
| 512 |
+
language = gr.Dropdown(
|
| 513 |
choices=["π―π΅ JP", "πΊπΈ EN"],
|
| 514 |
value="π―π΅ JP",
|
| 515 |
+
elem_classes="language-selector",
|
| 516 |
show_label=False,
|
| 517 |
+
container=False,
|
| 518 |
)
|
| 519 |
|
| 520 |
gr.HTML(TITLE)
|
style.css
CHANGED
|
@@ -1,60 +1,7 @@
|
|
| 1 |
-
.language-
|
| 2 |
position: absolute;
|
| 3 |
top: 10px;
|
| 4 |
right: 10px;
|
| 5 |
z-index: 1000;
|
| 6 |
width: auto;
|
| 7 |
}
|
| 8 |
-
|
| 9 |
-
#space-title {
|
| 10 |
-
margin-top: 50px; /* Add margin to the top of the title */
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
.language-switch-radio {
|
| 14 |
-
display: inline-flex !important;
|
| 15 |
-
gap: 0 !important;
|
| 16 |
-
border: 1px solid var(--border-color-primary);
|
| 17 |
-
border-radius: 4px;
|
| 18 |
-
overflow: hidden;
|
| 19 |
-
background-color: var(--background-fill-primary);
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
.language-switch-radio .gr-form {
|
| 23 |
-
display: contents;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.language-switch-radio .gr-radio-row {
|
| 27 |
-
display: contents;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
.language-switch-radio .gr-radio-row > div {
|
| 31 |
-
display: contents;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
.language-switch-radio input[type="radio"] {
|
| 35 |
-
display: none;
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
.language-switch-radio label {
|
| 39 |
-
padding: 5px 10px;
|
| 40 |
-
font-size: 14px;
|
| 41 |
-
min-width: 60px;
|
| 42 |
-
text-align: center;
|
| 43 |
-
cursor: pointer;
|
| 44 |
-
transition: background-color 0.3s, color 0.3s;
|
| 45 |
-
display: inline-block;
|
| 46 |
-
color: var(--body-text-color);
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.language-switch-radio input[type="radio"]:checked + label {
|
| 50 |
-
background-color: var(--primary-500);
|
| 51 |
-
color: var(--background-fill-primary);
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.language-switch-radio label:hover {
|
| 55 |
-
background-color: var(--background-fill-secondary);
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
.language-switch-radio input[type="radio"]:checked + label:hover {
|
| 59 |
-
background-color: var(--primary-600);
|
| 60 |
-
}
|
|
|
|
| 1 |
+
.language-selector {
|
| 2 |
position: absolute;
|
| 3 |
top: 10px;
|
| 4 |
right: 10px;
|
| 5 |
z-index: 1000;
|
| 6 |
width: auto;
|
| 7 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|