Claude commited on
Commit
556826e
·
unverified ·
1 Parent(s): 7ce911a

Disable SSR to fix blank page on Spaces; move theme/css to launch()

Browse files

gradio 6's server-side rendering fails inside the Hugging Face Space
iframe, leaving a blank white page with "Could not resolve app config".
Serve the classic client-rendered frontend via ssr_mode=False instead.
theme/css move from the Blocks constructor to launch(), where gradio 6
expects them (removes the deprecation warning).

Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -299,7 +299,7 @@ theme = gr.themes.Soft(
299
  font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui", "sans-serif"],
300
  )
301
 
302
- with gr.Blocks(title="Document Intelligence — OCR & Structured Data Extraction", theme=theme, css=CUSTOM_CSS) as demo:
303
  gr.Markdown(
304
  "# Turn Documents Into Structured Business Data\n"
305
  "AI-assisted OCR built for construction, compliance, and finance "
@@ -425,4 +425,12 @@ with gr.Blocks(title="Document Intelligence — OCR & Structured Data Extraction
425
  )
426
 
427
  if __name__ == "__main__":
428
- demo.launch(allowed_paths=[SAMPLE_DIR])
 
 
 
 
 
 
 
 
 
299
  font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui", "sans-serif"],
300
  )
301
 
302
+ with gr.Blocks(title="Document Intelligence — OCR & Structured Data Extraction") as demo:
303
  gr.Markdown(
304
  "# Turn Documents Into Structured Business Data\n"
305
  "AI-assisted OCR built for construction, compliance, and finance "
 
425
  )
426
 
427
  if __name__ == "__main__":
428
+ # ssr_mode=False: gradio 6's server-side rendering fails inside the
429
+ # Hugging Face Space iframe ("Could not resolve app config" on a blank
430
+ # page), so serve the classic client-rendered frontend instead.
431
+ demo.launch(
432
+ theme=theme,
433
+ css=CUSTOM_CSS,
434
+ allowed_paths=[SAMPLE_DIR],
435
+ ssr_mode=False,
436
+ )