YugJ commited on
Commit
aeb648b
·
verified ·
1 Parent(s): abfa285

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -15,8 +15,15 @@ import os
15
  import re
16
  import uuid
17
 
18
- import gradio as gr
19
- from dotenv import load_dotenv
 
 
 
 
 
 
 
20
 
21
  # override=False so real environment variables win over a stray .env file.
22
  # On a host, secrets arrive as env vars and must not be shadowed by a file.
 
15
  import re
16
  import uuid
17
 
18
+ # Gradio 6 defaults to server-side rendering, which fronts the Python app with
19
+ # a Node proxy. On Spaces that proxy shuts down immediately after startup and
20
+ # takes the app with it ("Stopping Node.js server..." then RUNTIME_ERROR).
21
+ # Nothing here needs SSR - it is a single interactive page, not a crawlable
22
+ # site - so turn it off before gradio is imported and reads the setting.
23
+ os.environ.setdefault("GRADIO_SSR_MODE", "false")
24
+
25
+ import gradio as gr # noqa: E402
26
+ from dotenv import load_dotenv # noqa: E402
27
 
28
  # override=False so real environment variables win over a stray .env file.
29
  # On a host, secrets arrive as env vars and must not be shadowed by a file.