Spaces:
Runtime error
Runtime error
Update app/schemas/image.py
Browse files- app/schemas/image.py +10 -18
app/schemas/image.py
CHANGED
|
@@ -1,8 +1,5 @@
|
|
| 1 |
from pydantic import BaseModel
|
| 2 |
from typing import Optional, Dict, Any
|
| 3 |
-
from fastapi import UploadFile, File # Import UploadFile and File
|
| 4 |
-
|
| 5 |
-
# --- Request Models ---
|
| 6 |
|
| 7 |
class EnhancePromptRequest(BaseModel):
|
| 8 |
raw_prompt: str
|
|
@@ -11,33 +8,28 @@ class GenerateImageRequest(BaseModel):
|
|
| 11 |
raw_prompt: Optional[str] = None
|
| 12 |
enhanced_prompt: Optional[str] = None
|
| 13 |
|
| 14 |
-
# UpdateImageRequest still needs base64 as it receives existing image for modification
|
| 15 |
class UpdateImageRequest(BaseModel):
|
| 16 |
text_instruction: str
|
| 17 |
image_base64: str
|
| 18 |
|
| 19 |
-
# VirtualTryOnRequest now expects UploadFile objects
|
| 20 |
-
# Note: For file uploads, it's often simpler to define them directly in the API endpoint function
|
| 21 |
-
# using `File()` or `Form()` for metadata, rather than in a Pydantic model for the request body.
|
| 22 |
-
# However, for consistency, we'll keep a schema here and handle parsing in the router.
|
| 23 |
-
# But for multipart/form-data, Pydantic models for request *body* are slightly different.
|
| 24 |
-
# The endpoint itself will directly take the UploadFile.
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
# --- Response Models ---
|
| 28 |
-
|
| 29 |
class EnhancePromptResponse(BaseModel):
|
| 30 |
raw_prompt: str
|
| 31 |
enhanced_prompt: str
|
| 32 |
|
| 33 |
-
# These response models no longer contain image_base64
|
| 34 |
-
# The image itself will be the response body.
|
| 35 |
class GenerateImageOnlyResponse(BaseModel):
|
| 36 |
-
text: Optional[str] = None
|
| 37 |
|
| 38 |
class UpdateImageOnlyResponse(BaseModel):
|
| 39 |
text: Optional[str] = None
|
| 40 |
|
| 41 |
class VirtualTryOnResponse(BaseModel):
|
| 42 |
summary: Dict[str, Any]
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from pydantic import BaseModel
|
| 2 |
from typing import Optional, Dict, Any
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
class EnhancePromptRequest(BaseModel):
|
| 5 |
raw_prompt: str
|
|
|
|
| 8 |
raw_prompt: Optional[str] = None
|
| 9 |
enhanced_prompt: Optional[str] = None
|
| 10 |
|
|
|
|
| 11 |
class UpdateImageRequest(BaseModel):
|
| 12 |
text_instruction: str
|
| 13 |
image_base64: str
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
class EnhancePromptResponse(BaseModel):
|
| 16 |
raw_prompt: str
|
| 17 |
enhanced_prompt: str
|
| 18 |
|
|
|
|
|
|
|
| 19 |
class GenerateImageOnlyResponse(BaseModel):
|
| 20 |
+
text: Optional[str] = None
|
| 21 |
|
| 22 |
class UpdateImageOnlyResponse(BaseModel):
|
| 23 |
text: Optional[str] = None
|
| 24 |
|
| 25 |
class VirtualTryOnResponse(BaseModel):
|
| 26 |
summary: Dict[str, Any]
|
| 27 |
+
|
| 28 |
+
class ShoeGenerateRequest(BaseModel):
|
| 29 |
+
style: str
|
| 30 |
+
color: Optional[str] = None
|
| 31 |
+
perspective: Optional[str] = None
|
| 32 |
+
variations: Optional[int] = 1
|
| 33 |
+
|
| 34 |
+
class ShoeGenerateResponse(BaseModel):
|
| 35 |
+
text: Optional[str] = None
|