Spaces:
Runtime error
Runtime error
File size: 622 Bytes
ce1dd07 |
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 29 |
from fastapi import APIRouter
from config import settings
import os
import json
router = APIRouter()
@router.get("/training")
async def run_training():
return {"message": "Sparrow ML training started"}
@router.get("/statistics")
async def get_statistics():
file_path = settings.training_stats_file
# Check if the file exists, and read its content
if os.path.exists(file_path):
with open(file_path, 'r') as file:
try:
content = json.load(file)
except json.JSONDecodeError:
content = []
else:
content = []
return content |