支持fastapi服务

This commit is contained in:
puke
2025-10-28 01:33:36 +08:00
committed by puke
parent c387137446
commit c200761b97
28 changed files with 1854 additions and 4 deletions

31
api/schemas/image.py Normal file
View File

@@ -0,0 +1,31 @@
"""
Image generation API schemas
"""
from typing import Optional
from pydantic import BaseModel, Field
class ImageGenerateRequest(BaseModel):
"""Image generation request"""
prompt: str = Field(..., description="Image generation prompt")
width: int = Field(1024, ge=512, le=2048, description="Image width")
height: int = Field(1024, ge=512, le=2048, description="Image height")
workflow: Optional[str] = Field(None, description="Custom workflow filename")
class Config:
json_schema_extra = {
"example": {
"prompt": "A serene mountain landscape at sunset, photorealistic style",
"width": 1024,
"height": 1024
}
}
class ImageGenerateResponse(BaseModel):
"""Image generation response"""
success: bool = True
message: str = "Success"
image_path: str = Field(..., description="Path to generated image")