VirusDumb commited on
Commit
2e5f3de
·
1 Parent(s): ec558a5

First pass

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -18,6 +18,11 @@ from __future__ import annotations
18
  import json
19
  import os
20
 
 
 
 
 
 
21
  from fastapi.responses import HTMLResponse
22
  from fastapi.staticfiles import StaticFiles
23
  from gradio import Server
@@ -59,4 +64,4 @@ def generate_image(photo_b64: str, art_style: str, scene_prompt: str, seed: int)
59
  demo = app
60
 
61
  if __name__ == "__main__":
62
- app.launch(show_error=True)
 
18
  import json
19
  import os
20
 
21
+ # Disable gradio SSR BEFORE importing gradio. We serve our own custom HTML at "/", so the
22
+ # Node SSR proxy is unwanted: it adds a second event loop (the "Invalid file descriptor: -1"
23
+ # teardown warning) and can intercept our routes. Must be set before `from gradio import ...`.
24
+ os.environ.setdefault("GRADIO_SSR_MODE", "false")
25
+
26
  from fastapi.responses import HTMLResponse
27
  from fastapi.staticfiles import StaticFiles
28
  from gradio import Server
 
64
  demo = app
65
 
66
  if __name__ == "__main__":
67
+ app.launch(show_error=True, ssr_mode=False)