thera-guide-ai / app.py
Said Lfagrouche
Add Hugging Face Space configuration
6ca0914
raw
history blame
1.15 kB
from fastapi import FastAPI
import os
import logging
# Set up logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Initialize FastAPI app
app = FastAPI(title="Mental Health Counselor API")
# Create necessary directories
os.makedirs("data/users", exist_ok=True)
os.makedirs("data/sessions", exist_ok=True)
os.makedirs("data/conversations", exist_ok=True)
os.makedirs("data/feedback", exist_ok=True)
# Define a simple health check route
@app.get("/health")
async def health_check():
return {"status": "ok", "message": "Mental Health Counselor API is running"}
# Define a simple root route
@app.get("/")
async def root():
return {
"app": "Mental Health Counselor API",
"status": "running",
"endpoints": [
"/health",
"/api-docs"
]
}
# Import the actual API if the file exists
try:
from api_mental_health import app as full_app
# Merge the routes from the full app
app.routes.extend(full_app.routes)
logger.info("Loaded full API functionality")
except ImportError:
logger.warning("Could not import full API functionality")