Spaces:
Runtime error
Runtime error
File size: 670 Bytes
19eed64 14ef02b 858b8f7 672d639 37f0512 f9c4160 a7c2292 f9c4160 a7c2292 858b8f7 f9c4160 864ac7d 858b8f7 fc3e061 14ef02b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import gradio as gr
import datetime
global language
md = "test"
CN_md = "测试"
def update_language(value):
if value == "zh-CN":
return [gr.update(visible=False), gr.update(visible=True)]
else:
return [gr.update(visible=False), gr.update(visible=True)]
with gr.Blocks() as demo:
with gr.Box(visible=False) as zh:
gr.Markdown(CN_md)
with gr.Box(visible=False) as eng:
gr.Markdown(md)
dt = gr.Textbox(label="Current time", visible=False)
dt.change(update_language, inputs=dt, outputs=[eng, zh])
demo.load(None, inputs=None, outputs=dt, _js="() => navigator.language")
demo.launch() |