21 lines
679 B
Python
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
|
|
``` |