-
Notifications
You must be signed in to change notification settings - Fork 9
/
models.py
49 lines (32 loc) · 1.08 KB
/
models.py
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
"""Module providing base models."""
from pydantic import BaseModel
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.
"""
is_nsfw: bool
confidence_percentage: 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