File size: 937 Bytes
7739d1f
7896889
7739d1f
7896889
 
7739d1f
 
 
a930b94
 
9998128
a930b94
 
 
 
 
 
7739d1f
 
 
a930b94
 
 
 
 
 
9998128
 
7739d1f
a930b94
 
 
7739d1f
 
 
a930b94
 
 
 
 
 
9998128
7739d1f
a930b94
 
7739d1f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# app/models.py
from pydantic import BaseModel
from typing import Optional, List


# =========================
# Upload
# =========================
class UploadResponse(BaseModel):
    image_id: str
    filename: str
    size_bytes: int
    content_type: str
    uploaded_at: str
    url: str


# =========================
# Classification
# =========================
class ClassifyRequest(BaseModel):
    image_id: str


class ClassifyResponse(BaseModel):
    image_id: str
    prediction: str
    confidence: float
    model_version: str = "hf_savedmodel"
    status: str = "completed"


# =========================
# Segmentation
# =========================
class SegmentRequest(BaseModel):
    image_id: str


class SegmentResponse(BaseModel):
    image_id: str
    status: str
    masks_shape: Optional[List[int]] = None
    max_confidence: Optional[float] = None
    result_url: Optional[str] = None
    error: Optional[str] = None