feat(US2): image quad extraction — POST /api/v1/image/extract
- app/models/image_models.py: BBox, QuadrupleItem, ImageExtract{Request,Response}
- app/services/image_service.py: download → base64 LLM → bbox clamp → crop upload
- app/routers/image.py: POST /image/extract handler
- tests: 4 service + 3 router tests, 7/7 passing
This commit is contained in:
BIN
app/models/__pycache__/image_models.cpython-312.pyc
Normal file
BIN
app/models/__pycache__/image_models.cpython-312.pyc
Normal file
Binary file not shown.
28
app/models/image_models.py
Normal file
28
app/models/image_models.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class BBox(BaseModel):
|
||||
x: int
|
||||
y: int
|
||||
w: int
|
||||
h: int
|
||||
|
||||
|
||||
class QuadrupleItem(BaseModel):
|
||||
subject: str
|
||||
predicate: str
|
||||
object: str
|
||||
qualifier: str | None = None
|
||||
bbox: BBox
|
||||
cropped_image_path: str
|
||||
|
||||
|
||||
class ImageExtractRequest(BaseModel):
|
||||
file_path: str
|
||||
task_id: int
|
||||
model: str | None = None
|
||||
prompt_template: str | None = None
|
||||
|
||||
|
||||
class ImageExtractResponse(BaseModel):
|
||||
items: list[QuadrupleItem]
|
||||
Reference in New Issue
Block a user