forked from humanbuildingsynergy/HEMA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_api.py
More file actions
28 lines (24 loc) · 834 Bytes
/
run_api.py
File metadata and controls
28 lines (24 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# HEMA - Home Energy Management Assistant
# Copyright (C) 2024-2026 Wooyoung Jung, HUBS Lab, University of Arizona
# Licensed under GPL-3.0. See LICENSE file for details.
# run_api.py
"""Entry point for running the FastAPI server."""
import os
import uvicorn
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
if __name__ == "__main__":
# Configuration
host = os.getenv("API_HOST", "0.0.0.0")
port = int(os.getenv("API_PORT", "8000"))
reload = os.getenv("API_RELOAD", "false").lower() == "true"
print(f"Starting Energy Analysis API server on {host}:{port}")
print(f"API Documentation: http://localhost:{port}/docs")
print(f"Health Check: http://localhost:{port}/health")
uvicorn.run(
"api.main:app",
host=host,
port=port,
reload=reload,
)