-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
1 parent
75b9cae
commit 4ce040a
Showing
6 changed files
with
225 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ python-multipart==0.0.9 | |
tensorflow==2.16.1 | ||
tf-keras==2.16.0 | ||
cachetools===5.3.3 | ||
pydantic===2.7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters