File size: 893 Bytes
4d6e8c2
 
 
4619a60
4d6e8c2
 
 
 
 
 
 
 
 
 
 
 
4619a60
 
 
 
 
 
 
 
 
 
 
 
 
 
4d6e8c2
 
 
 
 
f4fceae
4d6e8c2
4619a60
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
30
31
32
33
34
35
36
37
38
39
from fastapi import FastAPI
from dotenv import load_dotenv
from tasks import text, image, audio
from pathlib import Path

# Load environment variables
load_dotenv()

app = FastAPI(
    title="Frugal AI Challenge API",
    description="API for the Frugal AI Challenge evaluation endpoints"
)

# Include all routers
app.include_router(audio.router)

@app.get("/health")
async def health_check():
    try:
        model_exists = Path("/app/models/audio_model.pkl").exists()
        return {
            "status": "healthy",
            "model_loaded": model_exists
        }
    except Exception as e:
        return {
            "status": "unhealthy",
            "error": str(e)
        }

@app.get("/")
async def root():
    return {
        "message": "Welcome to the Frugal AI Challenge API",
        "endpoints": {
            "audio": "/audio - Audio classification task"
        }
    }