Spaces:
Running on Zero
Running on Zero
forge: block after launch so the process cannot exit; log launch outcome
Browse files
app.py
CHANGED
|
@@ -121,6 +121,15 @@ if __name__ == "__main__":
|
|
| 121 |
# That Node proxy is what dies here (log: "Running on local URL ... with SSR (Node
|
| 122 |
# proxy -> Python :7861)" then "Stopping Node.js server..."). Serving straight from
|
| 123 |
# Python removes the extra process entirely.
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
# That Node proxy is what dies here (log: "Running on local URL ... with SSR (Node
|
| 122 |
# proxy -> Python :7861)" then "Stopping Node.js server..."). Serving straight from
|
| 123 |
# Python removes the extra process entirely.
|
| 124 |
+
print("launching (ssr_mode=False)...", flush=True)
|
| 125 |
+
try:
|
| 126 |
+
demo.launch(server_name="0.0.0.0",
|
| 127 |
+
server_port=int(os.environ.get("PORT", 7860)),
|
| 128 |
+
ssr_mode=False)
|
| 129 |
+
except BaseException as exc:
|
| 130 |
+
print("launch raised %s: %r" % (type(exc).__name__, exc), flush=True)
|
| 131 |
+
# If launch() returns instead of blocking, the interpreter exits and takes the
|
| 132 |
+
# server with it (observed: "Running on local URL" then BaseEventLoop.__del__
|
| 133 |
+
# noise, i.e. shutdown). Block so the process cannot end.
|
| 134 |
+
print("launch returned; blocking main thread", flush=True)
|
| 135 |
+
threading.Event().wait()
|