ShadowInk commited on
Commit
fc7fd3d
·
verified ·
1 Parent(s): 4559592

Expose demo for Spaces and fix launch

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -1853,20 +1853,20 @@ def build_demo() -> gr.Blocks:
1853
  return demo
1854
 
1855
 
1856
- demo = build_demo().queue() if os.environ.get("SPACE_ID") else None
1857
 
1858
 
1859
  def launch_app(*, prevent_thread_lock: bool = False):
1860
- app_demo = demo if demo is not None else build_demo().queue()
1861
- # When running inside a Hugging Face Space, bind to 0.0.0.0 so the
1862
- # platform can route traffic to the container. Allow overriding via
1863
- # `VC_GRADIO_SERVER_NAME` for local development.
1864
- default_host = "0.0.0.0" if os.environ.get("SPACE_ID") else "127.0.0.1"
1865
- app_demo.launch(
1866
- server_name=os.environ.get("VC_GRADIO_SERVER_NAME", default_host),
1867
- server_port=int(os.environ.get("VC_GRADIO_PORT", "7861")),
1868
- prevent_thread_lock=prevent_thread_lock,
1869
- )
1870
  return app_demo
1871
 
1872
 
 
1853
  return demo
1854
 
1855
 
1856
+ demo = build_demo() if os.environ.get("SPACE_ID") else None
1857
 
1858
 
1859
  def launch_app(*, prevent_thread_lock: bool = False):
1860
+ app_demo = demo if demo is not None else build_demo().queue()
1861
+ # When running inside a Hugging Face Space, bind to 0.0.0.0 so the
1862
+ # platform can route traffic to the container. Allow overriding via
1863
+ # `VC_GRADIO_SERVER_NAME` for local development.
1864
+ default_host = "0.0.0.0" if os.environ.get("SPACE_ID") else "127.0.0.1"
1865
+ app_demo.launch(
1866
+ server_name=os.environ.get("VC_GRADIO_SERVER_NAME", default_host),
1867
+ server_port=int(os.environ.get("VC_GRADIO_PORT", "7861")),
1868
+ prevent_thread_lock=prevent_thread_lock,
1869
+ )
1870
  return app_demo
1871
 
1872