food-tr6kmp/endpoints/login.post.py
2025-03-27 18:47:10 +00:00

21 lines
679 B
Python

# Entity: FoodImage
```python
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
from core.database import get_db
from models.food_image import FoodImage
from schemas.food_image import FoodImageSchema, FoodImageCreate
from helpers.food_image_helpers import generate_food_image
router = APIRouter()
@router.post("/food-images", status_code=201, response_model=FoodImageSchema)
async def generate_food_photo(
food_details: FoodImageCreate,
db: Session = Depends(get_db)
):
"""Generate a photo of food based on provided details"""
generated_image = generate_food_image(db, food_details)
return generated_image
```