OpenHTR commited on
Commit
bde2db3
·
verified ·
1 Parent(s): bf559f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -141,7 +141,18 @@ CSS = """
141
  footer {visibility: hidden;}
142
  """
143
 
144
- with gr.Blocks(title=TITLE, css=CSS) as demo:
 
 
 
 
 
 
 
 
 
 
 
145
  gr.Markdown(
146
  f"# {TITLE}\n"
147
  "上传一张**整页中文手写**图片, 用画笔框出要重写的文字区域, 输入新文本, "
 
141
  footer {visibility: hidden;}
142
  """
143
 
144
+ # Gradio's built-in UI strings follow the browser locale. Force zh-CN before the
145
+ # app boots so the whole interface is Chinese regardless of the visitor's browser.
146
+ HEAD = """
147
+ <script>
148
+ try {
149
+ Object.defineProperty(navigator, "language", { get: () => "zh-CN" });
150
+ Object.defineProperty(navigator, "languages", { get: () => ["zh-CN", "zh"] });
151
+ } catch (e) {}
152
+ </script>
153
+ """
154
+
155
+ with gr.Blocks(title=TITLE, css=CSS, head=HEAD) as demo:
156
  gr.Markdown(
157
  f"# {TITLE}\n"
158
  "上传一张**整页中文手写**图片, 用画笔框出要重写的文字区域, 输入新文本, "