Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Standard library
|
| 2 |
import json
|
| 3 |
import os
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
# ==============================================================================
|
| 3 |
+
# Vision-Language and Face Recognition Utilities
|
| 4 |
+
# ==============================================================================
|
| 5 |
+
This module provides helper functions, lazy-loading mechanisms, and
|
| 6 |
+
API endpoint wrappers for multimodal inference, face recognition, and
|
| 7 |
+
video scene extraction.
|
| 8 |
+
|
| 9 |
+
It includes functionality for:
|
| 10 |
+
- Lazy initialization of heavyweight models (vision-language and face models)
|
| 11 |
+
- Image and video preprocessing
|
| 12 |
+
- Multimodal inference with configurable parameters (token limits, temperature)
|
| 13 |
+
- Facial embedding generation
|
| 14 |
+
- Scene extraction from video files
|
| 15 |
+
- Gradio UI components and endpoint definitions for user interaction
|
| 16 |
+
|
| 17 |
+
All functions and utilities are designed to be:
|
| 18 |
+
- Reusable and cache heavy models to reduce repeated loading
|
| 19 |
+
- Compatible with GPU/CPU execution
|
| 20 |
+
- Stateless and safe to call concurrently from multiple requests
|
| 21 |
+
- Modular, separating model logic from endpoint and UI handling
|
| 22 |
+
|
| 23 |
+
This module serves as the core interface layer between client-facing
|
| 24 |
+
APIs/UI and the underlying machine learning models.
|
| 25 |
+
# ==============================================================================
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
# Standard library
|
| 29 |
import json
|
| 30 |
import os
|