File size: 1,319 Bytes
507cd9a
 
 
 
 
538fbd6
 
 
 
 
 
 
 
 
 
507cd9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e5abf1b
 
507cd9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""Module providing base models."""

from pydantic import BaseModel


class ImageUrlRequest(BaseModel):
    """
    Model representing the request body for the /v1/detect/urls endpoint.

    Attributes:
        urls (list[str]): List of image URLs to be processed.
    """

    url: str

class ImageUrlsRequest(BaseModel):
    """
    Model representing the request body for the /v1/detect/urls endpoint.

    Attributes:
        urls (list[str]): List of image URLs to be processed.
    """

    urls: list[str]


class ImageDetectionResponse(BaseModel):
    """
    Base model representing the response body for image detection.

    Attributes:
        is_nsfw (bool): Whether the image is classified as NSFW.
        confidence_percentage (float): Confidence level of the NSFW classification.
    """

    prediction: str
    confidence: float


class FileImageDetectionResponse(ImageDetectionResponse):
    """
    Model extending ImageDetectionResponse with a file attribute.

    Attributes:
        file (str): The name of the file that was processed.
    """

    file_name: str


class UrlImageDetectionResponse(ImageDetectionResponse):
    """
    Model extending ImageDetectionResponse with a URL attribute.

    Attributes:
        url (str): The URL of the image that was processed.
    """

    url: str