Automated Action ab0e9b973a Implement tomato severity segmentation model API
- Set up FastAPI project structure with SQLite database
- Create database models for tomato images and severity classifications
- Implement image upload and processing endpoints
- Develop a segmentation model for tomato disease severity detection
- Add API endpoints for analysis and results retrieval
- Implement health check endpoint
- Set up Alembic for database migrations
- Update project documentation
2025-05-27 06:22:15 +00:00

35 lines
896 B
Python

import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.routes import health, tomato, model
from app.core.config import settings
app = FastAPI(
title=settings.PROJECT_NAME,
description="Tomato Severity Segmentation Model API",
version="0.1.0",
docs_url="/docs",
redoc_url="/redoc",
)
# Set up CORS
app.add_middleware(
CORSMiddleware,
allow_origins=settings.CORS_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include API routes
app.include_router(health.router, tags=["health"])
app.include_router(tomato.router, prefix="/api/tomatoes", tags=["tomatoes"])
app.include_router(model.router, prefix="/api/model", tags=["model"])
if __name__ == "__main__":
uvicorn.run(
"main:app",
host="0.0.0.0",
port=8000,
reload=settings.DEBUG,
)