Upload app.py with huggingface_hub

#2
by thangvip - opened
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import sys
2
  from pathlib import Path
3
 
@@ -6,9 +7,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parent / "src"))
6
  from compliment_forest.server import create_app
7
 
8
  app = create_app()
9
- demo = app
10
 
11
- if __name__ == "__main__":
12
- import uvicorn
13
-
14
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
1
+ import os
2
  import sys
3
  from pathlib import Path
4
 
 
7
  from compliment_forest.server import create_app
8
 
9
  app = create_app()
 
10
 
11
+ if os.getenv("SPACE_ID"):
12
+ app.launch(show_error=True)
13
+ elif __name__ == "__main__":
14
+ app.launch(server_name="0.0.0.0", server_port=7860)