simikkk commited on
Commit
d088ce8
·
verified ·
1 Parent(s): 458f553

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -855,9 +855,9 @@ body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);}
855
  </html>
856
  """
857
 
858
- # ─── STANDALONE JS (Gradio js= param — runs after DOM ready, avoids innerHTML script warning) ──
859
- APP_JS = """
860
- () => {
861
  /* UTILS */
862
  function showToast(msg, type='info') {
863
  const root = document.getElementById("toast-root");
@@ -1219,6 +1219,7 @@ function checkChatResponse(){
1219
 
1220
  setTimeout(checkLoginState, 600);
1221
  }
 
1222
  """
1223
 
1224
  # ─── GRADIO APP ──────────────────────────────────────────────────────────────
@@ -1234,8 +1235,8 @@ def gr_register_with_tos(username, password_encoded):
1234
  return db_register(username, password_encoded, "", True)
1235
 
1236
 
1237
- with gr.Blocks(title="OmniParse AI Enterprise", js=APP_JS) as demo:
1238
- gr.HTML(HTML_UI)
1239
 
1240
  with gr.Row(elem_id="hidden-controls", visible=False):
1241
  with gr.Column():
@@ -1295,5 +1296,4 @@ if __name__ == "__main__":
1295
  css=CUSTOM_CSS,
1296
  server_name="0.0.0.0",
1297
  server_port=7860,
1298
- show_api=False,
1299
  )
 
855
  </html>
856
  """
857
 
858
+ # ─── JS injected via gr.HTML(head=) — the only Gradio 6 way to run custom scripts ──
859
+ # APP_JS is wrapped in a <script> tag and passed to head= so the browser executes it.
860
+ APP_JS_HEAD = """<script defer>
861
  /* UTILS */
862
  function showToast(msg, type='info') {
863
  const root = document.getElementById("toast-root");
 
1219
 
1220
  setTimeout(checkLoginState, 600);
1221
  }
1222
+ </script>
1223
  """
1224
 
1225
  # ─── GRADIO APP ──────────────────────────────────────────────────────────────
 
1235
  return db_register(username, password_encoded, "", True)
1236
 
1237
 
1238
+ with gr.Blocks(title="OmniParse AI Enterprise") as demo:
1239
+ gr.HTML(HTML_UI, head=APP_JS_HEAD)
1240
 
1241
  with gr.Row(elem_id="hidden-controls", visible=False):
1242
  with gr.Column():
 
1296
  css=CUSTOM_CSS,
1297
  server_name="0.0.0.0",
1298
  server_port=7860,
 
1299
  )