Vsevolod commited on
Commit
57bffe7
·
1 Parent(s): 4e7020d

fixed startup

Browse files
Files changed (1) hide show
  1. run.py +6 -1
run.py CHANGED
@@ -1,3 +1,8 @@
 
1
  import subprocess
2
 
3
- subprocess.run("uvicorn app.main:app --host localhost --port 7860", shell=True)
 
 
 
 
 
1
+ import os
2
  import subprocess
3
 
4
+
5
+ on_hf_spaces = os.getenv("ON_HF_SPACES")
6
+ host = "0.0.0.0" if on_hf_spaces else "localhost"
7
+
8
+ subprocess.run(f"uvicorn app.main:app --host {host} --port 7860", shell=True)