mirror of
https://github.com/steelcityamir/safe-content-ai.git
synced 2024-10-03 21:38:34 +03:00
4ce040a5b2
* Update main.py * Update ci.yml * Update README.md * Update requirements.txt * Create models.py * Update main.py * Update test_main.py * Update README.md * Update models.py * Update test_main.py * Update main.py * Update main.py * Update models.py * Update main.py
50 lines
1.1 KiB
Python
50 lines
1.1 KiB
Python
"""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
|