Isk5434 commited on
Commit
f68b9e7
·
verified ·
1 Parent(s): 8301554

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -1549,5 +1549,14 @@ if "google.colab" in sys.modules:
1549
  run_colab(7860)
1550
  else:
1551
  # local python run (non-notebook)
1552
- import uvicorn
1553
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
 
 
 
 
 
 
 
 
 
1549
  run_colab(7860)
1550
  else:
1551
  # local python run (non-notebook)
1552
+ import uvicorn, pathlib
1553
+ _dir = pathlib.Path(__file__).parent
1554
+ _cert = _dir / "cert.pem"
1555
+ _key = _dir / "key.pem"
1556
+ if _cert.exists() and _key.exists():
1557
+ print(f"HTTPS mode: https://192.168.11.7:7860/")
1558
+ uvicorn.run(app, host="0.0.0.0", port=7860,
1559
+ ssl_certfile=str(_cert), ssl_keyfile=str(_key))
1560
+ else:
1561
+ print(f"HTTP mode (sensors may not work): http://0.0.0.0:7860/")
1562
+ uvicorn.run(app, host="0.0.0.0", port=7860)