Spaces:
Paused
Paused
Commit
·
2c44633
1
Parent(s):
1b76f70
Minor changes
Browse files- main/app.py +1 -4
- main/{config.yaml → resources/config.yaml} +0 -0
- main/utils/helpers.py +9 -1
main/app.py
CHANGED
|
@@ -4,11 +4,8 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 4 |
from .routes import router, init_router
|
| 5 |
from .utils.logging import setup_logger
|
| 6 |
from .utils.validation import validate_hf
|
|
|
|
| 7 |
|
| 8 |
-
def load_config():
|
| 9 |
-
"""Load configuration from yaml file"""
|
| 10 |
-
with open("main/config.yaml", "r") as f:
|
| 11 |
-
return yaml.safe_load(f)
|
| 12 |
|
| 13 |
config = load_config()
|
| 14 |
logger = setup_logger(config, "main")
|
|
|
|
| 4 |
from .routes import router, init_router
|
| 5 |
from .utils.logging import setup_logger
|
| 6 |
from .utils.validation import validate_hf
|
| 7 |
+
from .utils.helpers import load_config
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
config = load_config()
|
| 11 |
logger = setup_logger(config, "main")
|
main/{config.yaml → resources/config.yaml}
RENAMED
|
File without changes
|
main/utils/helpers.py
CHANGED
|
@@ -3,6 +3,9 @@ import torch
|
|
| 3 |
from pathlib import Path
|
| 4 |
from typing import Dict, Any
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
def get_system_info() -> Dict[str, Any]:
|
| 7 |
"""Get system resource information"""
|
| 8 |
return {
|
|
@@ -33,4 +36,9 @@ def format_memory_size(size_bytes: int) -> str:
|
|
| 33 |
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
|
| 34 |
if size_bytes < 1024:
|
| 35 |
return f"{size_bytes:.2f}{unit}"
|
| 36 |
-
size_bytes /= 1024
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from pathlib import Path
|
| 4 |
from typing import Dict, Any
|
| 5 |
|
| 6 |
+
import yaml
|
| 7 |
+
|
| 8 |
+
|
| 9 |
def get_system_info() -> Dict[str, Any]:
|
| 10 |
"""Get system resource information"""
|
| 11 |
return {
|
|
|
|
| 36 |
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
|
| 37 |
if size_bytes < 1024:
|
| 38 |
return f"{size_bytes:.2f}{unit}"
|
| 39 |
+
size_bytes /= 1024
|
| 40 |
+
|
| 41 |
+
def load_config():
|
| 42 |
+
"""Load configuration from yaml file"""
|
| 43 |
+
with open("main/resources/config.yaml", "r") as f:
|
| 44 |
+
return yaml.safe_load(f)
|