File size: 2,852 Bytes
b50c710 d154a5b c3cddd1 d154a5b c3cddd1 d154a5b c3cddd1 e1e5e39 c8776ee e1e5e39 7eed8f6 7ae4001 7eed8f6 382aeed d154a5b |
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
"""
# ==============================================================================
# API Schemas
# ==============================================================================
This module defines the schemas for the public-facing API endpoints used
by the Salamandra Vision 7B application. Each schema specifies the HTTP
method, endpoint path, expected input fields, and default values where
applicable. These schemas are used for client integration, validation,
and automatic documentation generation.
The endpoints defined here cover multiple types of input, including
multipart form-data for file uploads and JSON bodies for structured requests.
Each schema is structured as a dictionary to provide all necessary metadata
for request construction, validation, and automatic client use.
# ==============================================================================
"""
DESCRIBE_RAW_MULTIPART = {
"method": "POST",
"path": "/api/describe_raw",
"multipart_fields": [
{"name": "image", "type": "file"},
{"name": "text", "type": "text", "default": "Describe la imagen con detalle."},
{"name": "max_new_tokens", "type": "int", "default": 256},
{"name": "temperature", "type": "float", "default": 0.7}
]
}
PREDICT_JSON = {
"method": "POST",
"path": "/api/predict/describe",
"json_body": {"data": ["<file or url>", "prompt text", 256, 0.7]}
}
FACE_IMAGE_EMBEDDING = {
"method": "POST",
"path": "/api/face_image_embedding",
"multipart_fields": [
{"name": "image", "type": "file"}
]
}
SCENES_EXTRACTION = {
"method": "POST",
"path": "/api/scenes_extraction",
"multipart_fields": [
{"name": "video_file", "type": "str"},
{"name": "threshold", "type": "float", "default": 30.0, "description": "Sensibilidad para identificar escenas diferentes"},
{"name": "offset_frames", "type": "int", "default": 10, "description": "En vez de te coja la primera imagen de la escena te la coja un poco avanzada en la escena" },
{"name": "crop_ratio", "type": "float", "default": 0.1, "description": "Recorte en los bordes de la imagen (para evitar marcas de agua)"}
]
}
IMAGES_EVERY_SECOND_EXTRACTION = {
"method": "POST",
"path": "/api/keyframes_every_second_extraction",
"multipart_fields": [
{"name": "video_file", "type": "str"},
{"name": "crop_ratio", "type": "float", "default": 0.1, "description": "Recorte en los bordes de la imagen (para evitar marcas de agua)"}
]
}
IMAGE_LIST_DESCRIPTION = {
"method": "POST",
"path": "/api/describe_images",
"multipart_fields": [
{"name": "image", "type": "file"}
]
}
ADD_OCR_CHARACTERS = {
"method": "POST",
"path": "/api/add_ocr_characters_to_image",
"multipart_fields": [
{"name": "image", "type": "file"},
{"name": "informacion_image", "type": "string"},
{"name": "face_col", "type": "string"}
]
} |