diff --git a/.dockerignore b/.dockerignore index 15192cc641e69383438f64e3495d81781a39f50c..e4c7d63148b4585739b69f366af9abcb8c40a8e5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,27 +1,27 @@ -# Git -.git -.gitignore -.gitattributes - -# Dev tooling -.devcontainer -*.md - -# Python cache -__pycache__ -*.py[cod] -*.pyo -*.pyd -.Python - -# Virtual environments -.venv -venv -env - -# Uploaded files (runtime data — not needed at build time) -static/uploads/ - -# OS artefacts -.DS_Store -Thumbs.db +# Git +.git +.gitignore +.gitattributes + +# Dev tooling +.devcontainer +*.md + +# Python cache +__pycache__ +*.py[cod] +*.pyo +*.pyd +.Python + +# Virtual environments +.venv +venv +env + +# Uploaded files (runtime data — not needed at build time) +static/uploads/ + +# OS artefacts +.DS_Store +Thumbs.db diff --git a/.gitattributes b/.gitattributes index 7872b585fa8ca5330dd316b4158ecd1288eb1140..7988c3ceb18d2839ebf164153aca0b589c627115 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.h5 filter=lfs diff=lfs merge=lfs -text -detector.tflite filter=lfs diff=lfs merge=lfs -text +models/detector.tflite filter=lfs diff=lfs merge=lfs -text +static/uploads/Screenshot_2026-06-04_213003.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index d8378274f362dffc6d502b0afddc175169e3fa5e..7edf57224d7e3c442c841f8ba013aa99bf784b84 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ static/uploads/* # Downloaded MediaPipe Models # We ignore .tflite because the code automatically downloads it -models/*.tflite +# models/*.tflite # IDEs / Editor folders .vscode/ diff --git a/Dockerfile b/Dockerfile index 26a4e3bc49b2dfe7c1db01c7878144fd2fdcd440..d557eb568f9d99148382fa85740578121f6577fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,97 +1,69 @@ -# ============================================================ -# Stage 1: Builder — install Python dependencies -# ============================================================ -FROM python:3.11-slim AS builder - -WORKDIR /install - -# Build-time system deps (compilers, headers needed by grpcio, cffi, etc.) -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - wget \ - libgl1 \ - libglib2.0-0 \ - libgomp1 \ - libsm6 \ - libxext6 \ - libxrender1 \ - && rm -rf /var/lib/apt/lists/* - -COPY requirements.txt . - -# Install all Python deps + gunicorn into an isolated prefix -RUN pip install --no-cache-dir --prefix=/python-deps -r requirements.txt gunicorn - -# Pre-download the MediaPipe face-detector tflite model at build time -# so the container never needs to reach out to Google Storage at runtime. -RUN mkdir -p /models && \ - wget -q -O /models/detector.tflite \ - "https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite" - - -# ============================================================ -# Stage 2: Runtime image -# ============================================================ -FROM python:3.11-slim - -LABEL maintainer="undertone-classification" -LABEL description="Skin undertone classification — Flask + TensorFlow + MediaPipe (HF Spaces)" - -# Runtime system libs required by OpenCV and MediaPipe -# libgles2 → provides libGLESv2.so.2 (MediaPipe C bindings hard-require this) -# libegl1 → provides libEGL.so.1 (MediaPipe GPU/EGL path) -RUN apt-get update && apt-get install -y --no-install-recommends \ - libgl1 \ - libglib2.0-0 \ - libgomp1 \ - libsm6 \ - libxext6 \ - libxrender1 \ - libgles2 \ - libegl1 \ - && rm -rf /var/lib/apt/lists/* - -# Copy installed Python packages from the builder stage -COPY --from=builder /python-deps /usr/local - -# ── Hugging Face Spaces requirement ────────────────────────── -# HF Spaces runs containers with a non-root user (UID=1000, GID=1000). -# We create that user and make /app writable so Flask can write uploads. -RUN useradd -m -u 1000 appuser - -WORKDIR /app - -# Copy application source code -COPY app.py . -COPY templates/ templates/ -COPY static/ static/ -COPY models/ models/ - -# Copy the pre-downloaded tflite model into the models directory -COPY --from=builder /models/detector.tflite models/detector.tflite - -# Ensure the uploads directory exists and is owned by the runtime user -RUN mkdir -p static/uploads && \ - chown -R appuser:appuser /app - -USER appuser - -# ── Port ────────────────────────────────────────────────────── -# Hugging Face Spaces Docker SDK expects port 7860. -EXPOSE 7860 - -ENV FLASK_ENV=production \ - PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 \ - # Silence unnecessary TF / oneDNN log noise - TF_CPP_MIN_LOG_LEVEL=2 \ - TF_ENABLE_ONEDNN_OPTS=0 - -# 1 worker → global ai_engine singleton is shared; 180 s timeout for -# model load + first inference. -CMD ["gunicorn", \ - "--bind", "0.0.0.0:7860", \ - "--workers", "1", \ - "--timeout", "180", \ - "--log-level", "info", \ - "app:app"] +# ============================================================ +# Stage 1: Builder — install Python dependencies +# ============================================================ +FROM python:3.11-slim AS builder + +WORKDIR /install + +# System dependencies required to build some Python packages +# (OpenCV, MediaPipe, grpcio, cffi, etc.) +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + libgl1 \ + libglib2.0-0 \ + libgomp1 \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . + +# Install all Python deps into an isolated prefix so we can copy +# only the built packages to the final stage +# Also install gunicorn as the production WSGI server +RUN pip install --no-cache-dir --prefix=/python-deps -r requirements.txt gunicorn + + +# ============================================================ +# Stage 2: Runtime image +# ============================================================ +FROM python:3.11-slim + +LABEL maintainer="undertone-classification" +LABEL description="Skin undertone classification — Flask + TensorFlow + MediaPipe" + +# Runtime system libs (OpenCV needs libGL/libGLib; MediaPipe needs libgomp) +RUN apt-get update && apt-get install -y --no-install-recommends \ + libgl1 \ + libglib2.0-0 \ + libgomp1 \ + && rm -rf /var/lib/apt/lists/* + +# Copy installed Python packages from the builder stage +COPY --from=builder /python-deps /usr/local + +WORKDIR /app + +# Copy application source code +COPY app.py . +COPY templates/ templates/ +COPY static/ static/ +COPY models/ models/ + +# Create uploads directory that Flask writes to at runtime +RUN mkdir -p static/uploads + +# Expose Flask's default port +EXPOSE 5000 + +# Run with Gunicorn for production (single worker keeps model in memory) +# Falls back gracefully: if gunicorn is unavailable the CMD can be swapped +# to `python app.py` during development. +ENV FLASK_ENV=production \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +# Use gunicorn; 1 worker so the global ai_engine singleton is shared +CMD ["python", "-m", "gunicorn", \ + "--bind", "0.0.0.0:5000", \ + "--workers", "1", \ + "--timeout", "120", \ + "app:app"] diff --git a/README.md b/README.md index b096650077e9e673252bbc41c3d24f1b72b87ea1..2cf2de5b0a8b73e1c3e5ab956158a4016b97439a 100644 --- a/README.md +++ b/README.md @@ -1,86 +1,79 @@ ---- -title: Undertone Classification -sdk: docker -emoji: 📊 -colorFrom: blue -colorTo: green ---- -# Skin Undertone Classification - -Aplikasi web berbasis Flask untuk mendeteksi dan mengklasifikasikan *skin undertone* (Cool, Neutral, atau Warm) dari wajah seseorang. Aplikasi ini menggunakan MediaPipe untuk mendeteksi wajah dan memotongnya (cropping) sebelum diproses oleh model Deep Learning (ResNet50 dan MobileNetV2) menggunakan TensorFlow/Keras. - -## Fitur Utama -- **Face Detection:** Menggunakan MediaPipe (BlazeFace) untuk mendeteksi area wajah. -- **Undertone Classification:** Menggunakan model ResNet50 dan MobileNetV2 untuk memprediksi probabilitas undertone kulit ke dalam 3 kategori: `Cool`, `Neutral`, dan `Warm`. -- **Upload & Camera Input:** Mendukung prediksi dari gambar yang diunggah pengguna maupun gambar yang diambil langsung melalui kamera web (webcam). - -## Persyaratan (Requirements) -Aplikasi ini dikembangkan dan direkomendasikan untuk dijalankan menggunakan **Python 3.11**. - -## Instalasi dan Setup (Menggunakan Virtual Environment) - -Ikuti langkah-langkah berikut untuk mengatur lingkungan (environment) dan menjalankan aplikasi di komputer Anda. - -### 1. Buat Virtual Environment (venv) -Buka terminal (Command Prompt/PowerShell di Windows, atau Terminal di Mac/Linux), arahkan ke direktori proyek ini, lalu jalankan perintah berikut untuk membuat *virtual environment*: - -**Windows:** -```bash -python -m venv venv -``` - -**Mac/Linux:** -```bash -python3.11 -m venv venv -``` - -### 2. Aktifkan Virtual Environment -Setelah berhasil dibuat, *virtual environment* harus diaktifkan. - -**Windows (Command Prompt):** -```cmd -venv\Scripts\activate.bat -``` - -**Windows (PowerShell):** -```powershell -.\venv\Scripts\Activate.ps1 -``` - -**Mac/Linux:** -```bash -source venv/bin/activate -``` - -*Catatan: Anda akan melihat tulisan `(venv)` di awal baris terminal Anda jika environment sudah berhasil aktif.* - -### 3. Instalasi Library (Dependensi) -Pastikan *virtual environment* masih aktif, lalu instal semua *library* yang dibutuhkan dengan menggunakan `pip`: - -```bash -pip install flask mediapipe opencv-python tensorflow -``` - -## Cara Menjalankan Aplikasi - -Setelah semua library berhasil diinstal, Anda dapat menjalankan server Flask lokal dengan cara mengeksekusi file `app.py`: - -```bash -python app.py -``` - -Jika server berhasil berjalan, buka browser Anda dan kunjungi alamat berikut: -```text -http://127.0.0.1:5000/ -``` - -## Keterangan Kode (Struktur Proyek) -- `app.py`: File utama aplikasi (backend) yang menggunakan Flask. Menangani konfigurasi rute web, upload file gambar, menangkap gambar dari webcam, dan menghubungkannya dengan logika model AI (`UnderToneAI`). -- `UnderToneAI (di app.py)`: Kelas yang mengelola *loading* model klasifikasi `.h5`, mengunduh model Face Detector secara otomatis, serta melakukan pemotongan gambar wajah berdasarkan *bounding box* dari MediaPipe sebelum memprediksinya. -- `templates/index.html`: File antarmuka pengguna (frontend) tempat pengguna dapat berinteraksi (mengunggah foto atau mengambil dari webcam). -- `models/`: Folder tempat menyimpan model *machine learning* yang telah dilatih (`best_ResNet50.h5` dan `best_MobileNetV2.h5`) beserta detektor wajah MediaPipe. -- `static/uploads/`: Folder sementara tempat gambar asli dan gambar *crop* wajah disimpan agar dapat dimuat kembali dan ditampilkan di UI. - -## Catatan -- Pastikan file model klasifikasi (`best_ResNet50.h5` dan `best_MobileNetV2.h5`) sudah diletakkan di dalam folder `models/` agar aplikasi tidak mengalami error saat inisialisasi. -- Aplikasi akan otomatis mendownload model *Face Detector* dari MediaPipe (`blaze_face_short_range.tflite`) ke folder `models` pada saat pertama kali dijalankan, jadi pastikan Anda terkoneksi ke internet. \ No newline at end of file +# Skin Undertone Classification + +Aplikasi web berbasis Flask untuk mendeteksi dan mengklasifikasikan *skin undertone* (Cool, Neutral, atau Warm) dari wajah seseorang. Aplikasi ini menggunakan MediaPipe untuk mendeteksi wajah dan memotongnya (cropping) sebelum diproses oleh model Deep Learning (ResNet50 dan MobileNetV2) menggunakan TensorFlow/Keras. + +## Fitur Utama +- **Face Detection:** Menggunakan MediaPipe (BlazeFace) untuk mendeteksi area wajah. +- **Undertone Classification:** Menggunakan model ResNet50 dan MobileNetV2 untuk memprediksi probabilitas undertone kulit ke dalam 3 kategori: `Cool`, `Neutral`, dan `Warm`. +- **Upload & Camera Input:** Mendukung prediksi dari gambar yang diunggah pengguna maupun gambar yang diambil langsung melalui kamera web (webcam). + +## Persyaratan (Requirements) +Aplikasi ini dikembangkan dan direkomendasikan untuk dijalankan menggunakan **Python 3.11**. + +## Instalasi dan Setup (Menggunakan Virtual Environment) + +Ikuti langkah-langkah berikut untuk mengatur lingkungan (environment) dan menjalankan aplikasi di komputer Anda. + +### 1. Buat Virtual Environment (venv) +Buka terminal (Command Prompt/PowerShell di Windows, atau Terminal di Mac/Linux), arahkan ke direktori proyek ini, lalu jalankan perintah berikut untuk membuat *virtual environment*: + +**Windows:** +```bash +python -m venv venv +``` + +**Mac/Linux:** +```bash +python3.11 -m venv venv +``` + +### 2. Aktifkan Virtual Environment +Setelah berhasil dibuat, *virtual environment* harus diaktifkan. + +**Windows (Command Prompt):** +```cmd +venv\Scripts\activate.bat +``` + +**Windows (PowerShell):** +```powershell +.\venv\Scripts\Activate.ps1 +``` + +**Mac/Linux:** +```bash +source venv/bin/activate +``` + +*Catatan: Anda akan melihat tulisan `(venv)` di awal baris terminal Anda jika environment sudah berhasil aktif.* + +### 3. Instalasi Library (Dependensi) +Pastikan *virtual environment* masih aktif, lalu instal semua *library* yang dibutuhkan dengan menggunakan `pip`: + +```bash +pip install flask mediapipe opencv-python tensorflow +``` + +## Cara Menjalankan Aplikasi + +Setelah semua library berhasil diinstal, Anda dapat menjalankan server Flask lokal dengan cara mengeksekusi file `app.py`: + +```bash +python app.py +``` + +Jika server berhasil berjalan, buka browser Anda dan kunjungi alamat berikut: +```text +http://127.0.0.1:5000/ +``` + +## Keterangan Kode (Struktur Proyek) +- `app.py`: File utama aplikasi (backend) yang menggunakan Flask. Menangani konfigurasi rute web, upload file gambar, menangkap gambar dari webcam, dan menghubungkannya dengan logika model AI (`UnderToneAI`). +- `UnderToneAI (di app.py)`: Kelas yang mengelola *loading* model klasifikasi `.h5`, mengunduh model Face Detector secara otomatis, serta melakukan pemotongan gambar wajah berdasarkan *bounding box* dari MediaPipe sebelum memprediksinya. +- `templates/index.html`: File antarmuka pengguna (frontend) tempat pengguna dapat berinteraksi (mengunggah foto atau mengambil dari webcam). +- `models/`: Folder tempat menyimpan model *machine learning* yang telah dilatih (`best_ResNet50.h5` dan `best_MobileNetV2.h5`) beserta detektor wajah MediaPipe. +- `static/uploads/`: Folder sementara tempat gambar asli dan gambar *crop* wajah disimpan agar dapat dimuat kembali dan ditampilkan di UI. + +## Catatan +- Pastikan file model klasifikasi (`best_ResNet50.h5` dan `best_MobileNetV2.h5`) sudah diletakkan di dalam folder `models/` agar aplikasi tidak mengalami error saat inisialisasi. +- Aplikasi akan otomatis mendownload model *Face Detector* dari MediaPipe (`blaze_face_short_range.tflite`) ke folder `models` pada saat pertama kali dijalankan, jadi pastikan Anda terkoneksi ke internet. diff --git a/app.py b/app.py index 62fca9596ba53e884008fbc9af59da0a35a83898..8c67631e1ed40b724bb37076139caf8a5d4cc8bb 100644 --- a/app.py +++ b/app.py @@ -1,237 +1,237 @@ -import os -import cv2 -import numpy as np -import tensorflow as tf -import base64 -import urllib.request -from datetime import datetime -from flask import Flask, render_template, request, jsonify -from werkzeug.utils import secure_filename - -# Needed as custom_objects when loading models that have Lambda(preprocess_input) inside -from tensorflow.keras.applications.resnet50 import preprocess_input as resnet_preprocess -from tensorflow.keras.applications.mobilenet_v2 import preprocess_input as mobilenet_preprocess - -# MediaPipe V2 Imports -import mediapipe as mp -from mediapipe.tasks import python -from mediapipe.tasks.python import vision - -app = Flask(__name__) -app.config['UPLOAD_FOLDER'] = 'static/uploads' -MODEL_DIR = 'models' -DETECTOR_PATH = os.path.join(MODEL_DIR, 'detector.tflite') - - -# ========================================== -# 1. AI ENGINE -# ========================================== -class UnderToneAI: - def __init__(self, model_dir, detector_path): - self.model_dir = model_dir - self.model_path = detector_path - - # Lowercase + alphabetical order — matches flow_from_dataframe class assignment - # cool=0, neutral=1, warm=2 - self.classes = ['cool', 'neutral', 'warm'] - - self.models = {} - self.detector = None - - self._load_classification_models() - self._prepare_detector() - - # ------------------------------------------------------------------ - def _load_classification_models(self): - """ - The notebook bakes preprocess_input as a Lambda layer inside the model: - x = layers.Lambda(preprocess)(inp) - So we must pass it via custom_objects on load. - compile=False avoids optimizer-state errors. - """ - try: - self.models['resnet'] = tf.keras.models.load_model( - os.path.join(self.model_dir, 'best_ResNet50.h5'), - custom_objects={'preprocess_input': resnet_preprocess}, - compile=False - ) - self.models['mobilenet'] = tf.keras.models.load_model( - os.path.join(self.model_dir, 'best_MobileNetV2.h5'), - custom_objects={'preprocess_input': mobilenet_preprocess}, - compile=False - ) - print("[SUCCESS] Classification models loaded.") - except Exception as e: - print(f"[ERROR] Failed to load models: {e}") - raise - - # ------------------------------------------------------------------ - def _prepare_detector(self): - url = ( - "https://storage.googleapis.com/mediapipe-models/" - "face_detector/blaze_face_short_range/float16/1/" - "blaze_face_short_range.tflite" - ) - os.makedirs(self.model_dir, exist_ok=True) - - if not os.path.exists(self.model_path): - print(f"[INFO] Downloading detector to {self.model_path}...") - urllib.request.urlretrieve(url, self.model_path) - print("[SUCCESS] Download complete.") - - base_options = python.BaseOptions(model_asset_path=self.model_path) - # No min_detection_confidence — use default, matching new notebook - options = vision.FaceDetectorOptions(base_options=base_options) - self.detector = vision.FaceDetector.create_from_options(options) - - # ------------------------------------------------------------------ - def color_constancy(self, img, power=6): - """ - Shades of Gray color constancy — matches FaceProcessor.color_constancy() - in the new notebook. - Formula: scale each channel by (mean_of_means / channel_p-mean). - Input/output: BGR uint8. - """ - img_f = img.astype(np.float32) - # p-norm mean per channel - mean = np.power(np.mean(np.power(img_f, power), axis=(0, 1)), 1.0 / power) - scale = np.mean(mean) / (mean + 1e-6) # avoid div-by-zero - img_f *= scale - return np.clip(img_f, 0, 255).astype(np.uint8) - - # ------------------------------------------------------------------ - def _encode_b64(self, img_bgr, max_dim=640): - """Resize-then-encode a BGR image as a JPEG base64 data URL.""" - h, w = img_bgr.shape[:2] - if max(h, w) > max_dim: - scale = max_dim / max(h, w) - img_bgr = cv2.resize(img_bgr, (int(w * scale), int(h * scale))) - _, buf = cv2.imencode('.jpg', img_bgr, [cv2.IMWRITE_JPEG_QUALITY, 85]) - return 'data:image/jpeg;base64,' + base64.b64encode(buf).decode() - - def predict(self, img_path): - # 1. Load - img_bgr = cv2.imread(img_path) - if img_bgr is None: - return None, "Gagal membaca gambar" - - # 2. Shades of Gray color constancy — applied before detection, - # matching FaceProcessor.process_dataset() order in new notebook. - img_bgr = self.color_constancy(img_bgr) - - # 2b. Encode original (constancy-corrected) image for frontend display - original_b64 = self._encode_b64(img_bgr) - - # 3. Face detection — convert BGR→RGB then wrap in mp.Image - rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB) - mp_img = mp.Image(image_format=mp.ImageFormat.SRGB, data=rgb) - detection_result = self.detector.detect(mp_img) - - if not detection_result.detections: - return None, "Wajah tidak terdeteksi" - - # 4. Use first detection — matches new notebook (detections[0]) - bbox = detection_result.detections[0].bounding_box - x1 = int(bbox.origin_x) - y1 = int(bbox.origin_y) - x2 = int(x1 + bbox.width) - y2 = int(y1 + bbox.height) - - face = img_bgr[y1:y2, x1:x2] - - if face.size == 0: - return None, "Wajah tidak terdeteksi" - - # 5. Center ROI crop — take middle 40% of face region. - # Matches new notebook: face[h*0.3:h*0.7, w*0.3:w*0.7] - # This isolates cheek/nose skin, excluding hair, forehead, jaw. - h, w, _ = face.shape - roi = face[int(h * 0.3):int(h * 0.7), - int(w * 0.3):int(w * 0.7)] - - # 6. Resize ROI to model input size - roi_resized = cv2.resize(roi, (224, 224)) - - # 7. Save ROI crop for frontend display and encode as base64 - crop_name = f"crop_{os.path.basename(img_path)}" - cv2.imwrite(os.path.join(app.config['UPLOAD_FOLDER'], crop_name), roi_resized) - crop_b64 = self._encode_b64(roi_resized) - - # 8. Prepare model input. - # val_aug = ImageDataGenerator() has NO rescale/preprocessing_function. - # Model has Lambda(preprocess_input) internally → feed raw [0-255] float32. - face_rgb = cv2.cvtColor(roi_resized, cv2.COLOR_BGR2RGB) - face_input = face_rgb.astype(np.float32) # [0, 255], no /255 - face_input = np.expand_dims(face_input, axis=0) # (1, 224, 224, 3) - - # 9. Inference - res_raw = self.models['resnet'].predict(face_input, verbose=0)[0].tolist() - mob_raw = self.models['mobilenet'].predict(face_input, verbose=0)[0].tolist() - - return crop_name, original_b64, crop_b64, { - 'resnet': { - 'label': self.classes[int(np.argmax(res_raw))], - 'scores': {self.classes[i]: score for i, score in enumerate(res_raw)} - }, - 'mobilenet': { - 'label': self.classes[int(np.argmax(mob_raw))], - 'scores': {self.classes[i]: score for i, score in enumerate(mob_raw)} - } - } - - -# ========================================== -# 2. GLOBAL INSTANCE -# ========================================== -ai_engine = UnderToneAI(MODEL_DIR, DETECTOR_PATH) - - -# ========================================== -# 3. FLASK ROUTES -# ========================================== -@app.route('/') -def index(): - return render_template('index.html') - - -@app.route('/predict', methods=['POST']) -def predict(): - try: - if 'file' in request.files: - file = request.files['file'] - filename = secure_filename(file.filename) - filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) - file.save(filepath) - - elif request.json and 'image' in request.json: - data = request.json['image'] - _, encoded = data.split(",", 1) - decoded = base64.b64decode(encoded) - filename = f"cam_{datetime.now().strftime('%Y%m%d_%H%M%S')}.jpg" - filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) - with open(filepath, "wb") as f: - f.write(decoded) - - else: - return jsonify({'error': 'Invalid input'}), 400 - - crop_file, original_b64, crop_b64, results = ai_engine.predict(filepath) - - if not crop_file: - return jsonify({'error': original_b64}), 400 - - return jsonify({ - 'original': filename, - 'original_b64': original_b64, - 'crop': crop_file, - 'crop_b64': crop_b64, - 'results': results - }) - - except Exception as e: - return jsonify({'error': str(e)}), 500 - - -if __name__ == '__main__': - os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True) +import os +import cv2 +import numpy as np +import tensorflow as tf +import base64 +import urllib.request +from datetime import datetime +from flask import Flask, render_template, request, jsonify +from werkzeug.utils import secure_filename + +# Needed as custom_objects when loading models that have Lambda(preprocess_input) inside +from tensorflow.keras.applications.resnet50 import preprocess_input as resnet_preprocess +from tensorflow.keras.applications.mobilenet_v2 import preprocess_input as mobilenet_preprocess + +# MediaPipe V2 Imports +import mediapipe as mp +from mediapipe.tasks import python +from mediapipe.tasks.python import vision + +app = Flask(__name__) +app.config['UPLOAD_FOLDER'] = 'static/uploads' +MODEL_DIR = 'models' +DETECTOR_PATH = os.path.join(MODEL_DIR, 'detector.tflite') + + +# ========================================== +# 1. AI ENGINE +# ========================================== +class UnderToneAI: + def __init__(self, model_dir, detector_path): + self.model_dir = model_dir + self.model_path = detector_path + + # Lowercase + alphabetical order — matches flow_from_dataframe class assignment + # cool=0, neutral=1, warm=2 + self.classes = ['cool', 'neutral', 'warm'] + + self.models = {} + self.detector = None + + self._load_classification_models() + self._prepare_detector() + + # ------------------------------------------------------------------ + def _load_classification_models(self): + """ + The notebook bakes preprocess_input as a Lambda layer inside the model: + x = layers.Lambda(preprocess)(inp) + So we must pass it via custom_objects on load. + compile=False avoids optimizer-state errors. + """ + try: + self.models['resnet'] = tf.keras.models.load_model( + os.path.join(self.model_dir, 'best_ResNet50.h5'), + custom_objects={'preprocess_input': resnet_preprocess}, + compile=False + ) + self.models['mobilenet'] = tf.keras.models.load_model( + os.path.join(self.model_dir, 'best_MobileNetV2.h5'), + custom_objects={'preprocess_input': mobilenet_preprocess}, + compile=False + ) + print("[SUCCESS] Classification models loaded.") + except Exception as e: + print(f"[ERROR] Failed to load models: {e}") + raise + + # ------------------------------------------------------------------ + def _prepare_detector(self): + url = ( + "https://storage.googleapis.com/mediapipe-models/" + "face_detector/blaze_face_short_range/float16/1/" + "blaze_face_short_range.tflite" + ) + os.makedirs(self.model_dir, exist_ok=True) + + if not os.path.exists(self.model_path): + print(f"[INFO] Downloading detector to {self.model_path}...") + urllib.request.urlretrieve(url, self.model_path) + print("[SUCCESS] Download complete.") + + base_options = python.BaseOptions(model_asset_path=self.model_path) + # No min_detection_confidence — use default, matching new notebook + options = vision.FaceDetectorOptions(base_options=base_options) + self.detector = vision.FaceDetector.create_from_options(options) + + # ------------------------------------------------------------------ + def color_constancy(self, img, power=6): + """ + Shades of Gray color constancy — matches FaceProcessor.color_constancy() + in the new notebook. + Formula: scale each channel by (mean_of_means / channel_p-mean). + Input/output: BGR uint8. + """ + img_f = img.astype(np.float32) + # p-norm mean per channel + mean = np.power(np.mean(np.power(img_f, power), axis=(0, 1)), 1.0 / power) + scale = np.mean(mean) / (mean + 1e-6) # avoid div-by-zero + img_f *= scale + return np.clip(img_f, 0, 255).astype(np.uint8) + + # ------------------------------------------------------------------ + def _encode_b64(self, img_bgr, max_dim=640): + """Resize-then-encode a BGR image as a JPEG base64 data URL.""" + h, w = img_bgr.shape[:2] + if max(h, w) > max_dim: + scale = max_dim / max(h, w) + img_bgr = cv2.resize(img_bgr, (int(w * scale), int(h * scale))) + _, buf = cv2.imencode('.jpg', img_bgr, [cv2.IMWRITE_JPEG_QUALITY, 85]) + return 'data:image/jpeg;base64,' + base64.b64encode(buf).decode() + + def predict(self, img_path): + # 1. Load + img_bgr = cv2.imread(img_path) + if img_bgr is None: + return None, "Gagal membaca gambar" + + # 2. Shades of Gray color constancy — applied before detection, + # matching FaceProcessor.process_dataset() order in new notebook. + img_bgr = self.color_constancy(img_bgr) + + # 2b. Encode original (constancy-corrected) image for frontend display + original_b64 = self._encode_b64(img_bgr) + + # 3. Face detection — convert BGR→RGB then wrap in mp.Image + rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB) + mp_img = mp.Image(image_format=mp.ImageFormat.SRGB, data=rgb) + detection_result = self.detector.detect(mp_img) + + if not detection_result.detections: + return None, "Wajah tidak terdeteksi" + + # 4. Use first detection — matches new notebook (detections[0]) + bbox = detection_result.detections[0].bounding_box + x1 = int(bbox.origin_x) + y1 = int(bbox.origin_y) + x2 = int(x1 + bbox.width) + y2 = int(y1 + bbox.height) + + face = img_bgr[y1:y2, x1:x2] + + if face.size == 0: + return None, "Wajah tidak terdeteksi" + + # 5. Center ROI crop — take middle 40% of face region. + # Matches new notebook: face[h*0.3:h*0.7, w*0.3:w*0.7] + # This isolates cheek/nose skin, excluding hair, forehead, jaw. + h, w, _ = face.shape + roi = face[int(h * 0.3):int(h * 0.7), + int(w * 0.3):int(w * 0.7)] + + # 6. Resize ROI to model input size + roi_resized = cv2.resize(roi, (224, 224)) + + # 7. Save ROI crop for frontend display and encode as base64 + crop_name = f"crop_{os.path.basename(img_path)}" + cv2.imwrite(os.path.join(app.config['UPLOAD_FOLDER'], crop_name), roi_resized) + crop_b64 = self._encode_b64(roi_resized) + + # 8. Prepare model input. + # val_aug = ImageDataGenerator() has NO rescale/preprocessing_function. + # Model has Lambda(preprocess_input) internally → feed raw [0-255] float32. + face_rgb = cv2.cvtColor(roi_resized, cv2.COLOR_BGR2RGB) + face_input = face_rgb.astype(np.float32) # [0, 255], no /255 + face_input = np.expand_dims(face_input, axis=0) # (1, 224, 224, 3) + + # 9. Inference + res_raw = self.models['resnet'].predict(face_input, verbose=0)[0].tolist() + mob_raw = self.models['mobilenet'].predict(face_input, verbose=0)[0].tolist() + + return crop_name, original_b64, crop_b64, { + 'resnet': { + 'label': self.classes[int(np.argmax(res_raw))], + 'scores': {self.classes[i]: score for i, score in enumerate(res_raw)} + }, + 'mobilenet': { + 'label': self.classes[int(np.argmax(mob_raw))], + 'scores': {self.classes[i]: score for i, score in enumerate(mob_raw)} + } + } + + +# ========================================== +# 2. GLOBAL INSTANCE +# ========================================== +ai_engine = UnderToneAI(MODEL_DIR, DETECTOR_PATH) + + +# ========================================== +# 3. FLASK ROUTES +# ========================================== +@app.route('/') +def index(): + return render_template('index.html') + + +@app.route('/predict', methods=['POST']) +def predict(): + try: + if 'file' in request.files: + file = request.files['file'] + filename = secure_filename(file.filename) + filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) + file.save(filepath) + + elif request.json and 'image' in request.json: + data = request.json['image'] + _, encoded = data.split(",", 1) + decoded = base64.b64decode(encoded) + filename = f"cam_{datetime.now().strftime('%Y%m%d_%H%M%S')}.jpg" + filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) + with open(filepath, "wb") as f: + f.write(decoded) + + else: + return jsonify({'error': 'Invalid input'}), 400 + + crop_file, original_b64, crop_b64, results = ai_engine.predict(filepath) + + if not crop_file: + return jsonify({'error': original_b64}), 400 + + return jsonify({ + 'original': filename, + 'original_b64': original_b64, + 'crop': crop_file, + 'crop_b64': crop_b64, + 'results': results + }) + + except Exception as e: + return jsonify({'error': str(e)}), 500 + + +if __name__ == '__main__': + os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True) app.run(debug=True, port=5000) \ No newline at end of file diff --git a/models/best_MobileNetV2.h5 b/models/best_MobileNetV2.h5 index 7cb903270333d4efcfce484123a840ee2b00c366..4ef77759279ab1aadea7ea3a80571b0f99df4f17 100644 --- a/models/best_MobileNetV2.h5 +++ b/models/best_MobileNetV2.h5 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:409176b4f87badcc4ac61b2bcfbeb9e31c7d59f58e2711fcbc5316e6727446dd -size 13350064 +oid sha256:54a5ba4759b56a43a3cb06619b6f0b57dd8beecf04bca9a74f69b2d5812ae51e +size 25587680 diff --git a/models/best_ResNet50.h5 b/models/best_ResNet50.h5 index 7197e85953b1eac90987785b70563f55d731e473..f83d250f5753fed10aba20fde230307a88b7bf04 100644 --- a/models/best_ResNet50.h5 +++ b/models/best_ResNet50.h5 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:86cd06a15463e420ef4de1b8eb5f31dbd8b33520365421c2df6089bdd81d449e -size 101058000 +oid sha256:4e00ccb91d5b001fd6162652e35e984cb5927e196239be8ef448061254400c48 +size 216688264 diff --git a/static/uploads/Screenshot_2026-06-04_213003.png b/static/uploads/Screenshot_2026-06-04_213003.png new file mode 100644 index 0000000000000000000000000000000000000000..1ae01b85b191c463af6b4a4c52cb0d41b3e0d930 --- /dev/null +++ b/static/uploads/Screenshot_2026-06-04_213003.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2afaaa95ae3a20e99ea3ca24db69ed8d2d44a2a1adc7819497bbbe6ecbf276e6 +size 135532 diff --git a/static/uploads/WhatsApp_Image_2026-06-04_at_21.19.01.jpeg b/static/uploads/WhatsApp_Image_2026-06-04_at_21.19.01.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..e13df6dfb13b8abda1238865f36f1554e950bffc Binary files /dev/null and b/static/uploads/WhatsApp_Image_2026-06-04_at_21.19.01.jpeg differ diff --git a/static/uploads/cam_20260604_213126.jpg b/static/uploads/cam_20260604_213126.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d13946250855d20381b6079f186925d5c2ca6940 Binary files /dev/null and b/static/uploads/cam_20260604_213126.jpg differ diff --git a/static/uploads/cam_20260708_163346.jpg b/static/uploads/cam_20260708_163346.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a40b318a6f91a9559f77f80ecd2a0bc0424c3384 Binary files /dev/null and b/static/uploads/cam_20260708_163346.jpg differ diff --git a/static/uploads/cam_20260708_163415.jpg b/static/uploads/cam_20260708_163415.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3a1de2de312c38a3bfc53ef1db1e89f5d10bdf63 Binary files /dev/null and b/static/uploads/cam_20260708_163415.jpg differ diff --git a/static/uploads/cam_20260708_163424.jpg b/static/uploads/cam_20260708_163424.jpg new file mode 100644 index 0000000000000000000000000000000000000000..679ca866b9f56d92ee13069dc06f5f994dc4a059 Binary files /dev/null and b/static/uploads/cam_20260708_163424.jpg differ diff --git a/static/uploads/cam_20260708_163452.jpg b/static/uploads/cam_20260708_163452.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9d299f1bdfb2f13499be9457b273f98a86aa8ecb Binary files /dev/null and b/static/uploads/cam_20260708_163452.jpg differ diff --git a/static/uploads/cam_20260708_163503.jpg b/static/uploads/cam_20260708_163503.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0ef6dc4f81ee25a6445cb71a90f39dd643717ba6 Binary files /dev/null and b/static/uploads/cam_20260708_163503.jpg differ diff --git a/static/uploads/cam_20260708_163508.jpg b/static/uploads/cam_20260708_163508.jpg new file mode 100644 index 0000000000000000000000000000000000000000..012522ea2347e9ab79fb8c18af94f2f1dcfaaabf Binary files /dev/null and b/static/uploads/cam_20260708_163508.jpg differ diff --git a/static/uploads/cam_20260708_163516.jpg b/static/uploads/cam_20260708_163516.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fce2cef5886e3eb7c3069d61feb4e80dbc65b1d6 Binary files /dev/null and b/static/uploads/cam_20260708_163516.jpg differ diff --git a/static/uploads/cam_20260708_163520.jpg b/static/uploads/cam_20260708_163520.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aaf0d8dc6feed6341d288f6f03bf22189d241c35 Binary files /dev/null and b/static/uploads/cam_20260708_163520.jpg differ diff --git a/static/uploads/cam_20260708_163526.jpg b/static/uploads/cam_20260708_163526.jpg new file mode 100644 index 0000000000000000000000000000000000000000..00e820e1775e5db1e090c59974364a2283db8bf4 Binary files /dev/null and b/static/uploads/cam_20260708_163526.jpg differ diff --git a/static/uploads/cam_20260708_163532.jpg b/static/uploads/cam_20260708_163532.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1eb2d8038114b22a8e3db1775b54467cc9bb0e11 Binary files /dev/null and b/static/uploads/cam_20260708_163532.jpg differ diff --git a/static/uploads/cam_20260708_163541.jpg b/static/uploads/cam_20260708_163541.jpg new file mode 100644 index 0000000000000000000000000000000000000000..452615a0f9494edf8149f030fba6ab6c797a3b1d Binary files /dev/null and b/static/uploads/cam_20260708_163541.jpg differ diff --git a/static/uploads/cam_20260708_163700.jpg b/static/uploads/cam_20260708_163700.jpg new file mode 100644 index 0000000000000000000000000000000000000000..df9ae3b97ad6751bfb41f19c636f3ee6837027e5 Binary files /dev/null and b/static/uploads/cam_20260708_163700.jpg differ diff --git a/static/uploads/cam_20260708_163709.jpg b/static/uploads/cam_20260708_163709.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d4817e7e01698f0c325f7bc84db23d845856ab62 Binary files /dev/null and b/static/uploads/cam_20260708_163709.jpg differ diff --git a/static/uploads/cam_20260708_163715.jpg b/static/uploads/cam_20260708_163715.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c0211b0e793db49a8258cc86e4fc6ad479821d23 Binary files /dev/null and b/static/uploads/cam_20260708_163715.jpg differ diff --git a/static/uploads/cam_20260708_163724.jpg b/static/uploads/cam_20260708_163724.jpg new file mode 100644 index 0000000000000000000000000000000000000000..00de6cb293a607867656bb890bdccc038ccc8150 Binary files /dev/null and b/static/uploads/cam_20260708_163724.jpg differ diff --git a/static/uploads/cam_20260708_163731.jpg b/static/uploads/cam_20260708_163731.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1a7378401a928c1a4b5745b5c514973270ec512c Binary files /dev/null and b/static/uploads/cam_20260708_163731.jpg differ diff --git a/static/uploads/cam_20260708_163748.jpg b/static/uploads/cam_20260708_163748.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7acf9a41ca9f5098707f4e2ee0bda16cd207dec5 Binary files /dev/null and b/static/uploads/cam_20260708_163748.jpg differ diff --git a/static/uploads/cam_20260708_163818.jpg b/static/uploads/cam_20260708_163818.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7fdcabf2d861fead221cfb7c97b11975154ec3fd Binary files /dev/null and b/static/uploads/cam_20260708_163818.jpg differ diff --git a/static/uploads/cam_20260708_163824.jpg b/static/uploads/cam_20260708_163824.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4a08b17b1cf317ea72a25a9e0d291166cf38510b Binary files /dev/null and b/static/uploads/cam_20260708_163824.jpg differ diff --git a/static/uploads/cam_20260708_163830.jpg b/static/uploads/cam_20260708_163830.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7bf7cb027e2c2584c3c61ad95fe0d1f7d0fe33db Binary files /dev/null and b/static/uploads/cam_20260708_163830.jpg differ diff --git a/static/uploads/cam_20260708_163837.jpg b/static/uploads/cam_20260708_163837.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6371a4573a2cd1b95ea48c2583ceca14184e2b30 Binary files /dev/null and b/static/uploads/cam_20260708_163837.jpg differ diff --git a/static/uploads/cam_20260708_163847.jpg b/static/uploads/cam_20260708_163847.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3400593904002ddfb5b58415374688498738488a Binary files /dev/null and b/static/uploads/cam_20260708_163847.jpg differ diff --git a/static/uploads/cam_20260709_084845.jpg b/static/uploads/cam_20260709_084845.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5ecaf8ff4623cb6d3f90bad81d70cb0f8d0c6443 Binary files /dev/null and b/static/uploads/cam_20260709_084845.jpg differ diff --git a/static/uploads/cam_20260709_085000.jpg b/static/uploads/cam_20260709_085000.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bc9c58f3a0d1e7b3915b7aab0618bfb1af96d25f Binary files /dev/null and b/static/uploads/cam_20260709_085000.jpg differ diff --git a/static/uploads/cam_20260709_085021.jpg b/static/uploads/cam_20260709_085021.jpg new file mode 100644 index 0000000000000000000000000000000000000000..113f82fe86e2669a80629e2ef3917ae3d33f1bc3 Binary files /dev/null and b/static/uploads/cam_20260709_085021.jpg differ diff --git a/static/uploads/cam_20260709_085046.jpg b/static/uploads/cam_20260709_085046.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9abe70eb8fd8db3baf6e769ef5fedab3a41a3a09 Binary files /dev/null and b/static/uploads/cam_20260709_085046.jpg differ diff --git a/static/uploads/cam_20260709_085055.jpg b/static/uploads/cam_20260709_085055.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8b6dc8c50e7600ae1cddc81611fe82399f4821dc Binary files /dev/null and b/static/uploads/cam_20260709_085055.jpg differ diff --git a/static/uploads/cam_20260709_085107.jpg b/static/uploads/cam_20260709_085107.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f02e1e0a2fe12446948db7ec8ce94394cf992c76 Binary files /dev/null and b/static/uploads/cam_20260709_085107.jpg differ diff --git a/static/uploads/cam_20260709_085116.jpg b/static/uploads/cam_20260709_085116.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1248e376226a3547444c2d895d8aef25a2bf0d7b Binary files /dev/null and b/static/uploads/cam_20260709_085116.jpg differ diff --git a/static/uploads/cam_20260709_085136.jpg b/static/uploads/cam_20260709_085136.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0d85b79a515d9b7be652bca6956db29091dde978 Binary files /dev/null and b/static/uploads/cam_20260709_085136.jpg differ diff --git a/static/uploads/cam_20260709_085151.jpg b/static/uploads/cam_20260709_085151.jpg new file mode 100644 index 0000000000000000000000000000000000000000..adcd8901dcbb5981bca98fe4b4bd7bb803f26bbe Binary files /dev/null and b/static/uploads/cam_20260709_085151.jpg differ diff --git a/static/uploads/cam_20260709_085209.jpg b/static/uploads/cam_20260709_085209.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a196d72ba9989fcedae150718618d5823fa619cb Binary files /dev/null and b/static/uploads/cam_20260709_085209.jpg differ diff --git a/static/uploads/cam_20260709_085224.jpg b/static/uploads/cam_20260709_085224.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2840b739814adbd6884db1f95e4aa446b90240df Binary files /dev/null and b/static/uploads/cam_20260709_085224.jpg differ diff --git a/static/uploads/crop_Screenshot_2026-06-04_213003.png b/static/uploads/crop_Screenshot_2026-06-04_213003.png new file mode 100644 index 0000000000000000000000000000000000000000..075856fa1f5da1ede043ab29d97a64f53855d761 Binary files /dev/null and b/static/uploads/crop_Screenshot_2026-06-04_213003.png differ diff --git a/static/uploads/crop_WhatsApp_Image_2026-06-04_at_21.19.01.jpeg b/static/uploads/crop_WhatsApp_Image_2026-06-04_at_21.19.01.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..aaaa12eb360defe2bea826343bf9678c084fd9c8 Binary files /dev/null and b/static/uploads/crop_WhatsApp_Image_2026-06-04_at_21.19.01.jpeg differ diff --git a/static/uploads/crop_cam_20260604_213126.jpg b/static/uploads/crop_cam_20260604_213126.jpg new file mode 100644 index 0000000000000000000000000000000000000000..acd451748ecff8bdbbca0812e1a1c6a6e3c752d6 Binary files /dev/null and b/static/uploads/crop_cam_20260604_213126.jpg differ diff --git a/static/uploads/crop_cam_20260708_163346.jpg b/static/uploads/crop_cam_20260708_163346.jpg new file mode 100644 index 0000000000000000000000000000000000000000..313ec49eb7885ff3d5e4d26670de9ef7b183c489 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163346.jpg differ diff --git a/static/uploads/crop_cam_20260708_163415.jpg b/static/uploads/crop_cam_20260708_163415.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0cc9993cd1b147d049ee2c2f902dc576c1d282a1 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163415.jpg differ diff --git a/static/uploads/crop_cam_20260708_163424.jpg b/static/uploads/crop_cam_20260708_163424.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7fc3a12c5df3fa7bb8e59386f20e0de6fd5e8eb8 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163424.jpg differ diff --git a/static/uploads/crop_cam_20260708_163452.jpg b/static/uploads/crop_cam_20260708_163452.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2ca4a8f6d05e7efed9f9b13d888f29e8c659976b Binary files /dev/null and b/static/uploads/crop_cam_20260708_163452.jpg differ diff --git a/static/uploads/crop_cam_20260708_163503.jpg b/static/uploads/crop_cam_20260708_163503.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c3b639afa3f698d032c3c199f97704676545ffc6 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163503.jpg differ diff --git a/static/uploads/crop_cam_20260708_163508.jpg b/static/uploads/crop_cam_20260708_163508.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ddd47f7af8de667f80d2acce7b790a0114a383e7 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163508.jpg differ diff --git a/static/uploads/crop_cam_20260708_163516.jpg b/static/uploads/crop_cam_20260708_163516.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cb9a0c77fc375d25c1404a6b077d16a5ef0ec7d8 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163516.jpg differ diff --git a/static/uploads/crop_cam_20260708_163520.jpg b/static/uploads/crop_cam_20260708_163520.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a1fd31bb129892fef5d78575fc4e933560b18976 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163520.jpg differ diff --git a/static/uploads/crop_cam_20260708_163526.jpg b/static/uploads/crop_cam_20260708_163526.jpg new file mode 100644 index 0000000000000000000000000000000000000000..49a89249bb55735096180a54e38303945a2923c5 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163526.jpg differ diff --git a/static/uploads/crop_cam_20260708_163532.jpg b/static/uploads/crop_cam_20260708_163532.jpg new file mode 100644 index 0000000000000000000000000000000000000000..07746b345e37937f9cfbad3db2ae013421bee4c7 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163532.jpg differ diff --git a/static/uploads/crop_cam_20260708_163541.jpg b/static/uploads/crop_cam_20260708_163541.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0d2ee3154c8b4cd0872f1d2b2a0bdee60712a353 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163541.jpg differ diff --git a/static/uploads/crop_cam_20260708_163700.jpg b/static/uploads/crop_cam_20260708_163700.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4da166d41c78c04d5785704155cc5893ae706ed5 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163700.jpg differ diff --git a/static/uploads/crop_cam_20260708_163709.jpg b/static/uploads/crop_cam_20260708_163709.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ab28440d19cc340ef4b5eb96bb45b8f0ad05c2ec Binary files /dev/null and b/static/uploads/crop_cam_20260708_163709.jpg differ diff --git a/static/uploads/crop_cam_20260708_163715.jpg b/static/uploads/crop_cam_20260708_163715.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c254cfff915b43d880101c9ac196cfc2c77def0e Binary files /dev/null and b/static/uploads/crop_cam_20260708_163715.jpg differ diff --git a/static/uploads/crop_cam_20260708_163724.jpg b/static/uploads/crop_cam_20260708_163724.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cdad1c5b8f83ab2766f8c5dfb03223553678853d Binary files /dev/null and b/static/uploads/crop_cam_20260708_163724.jpg differ diff --git a/static/uploads/crop_cam_20260708_163731.jpg b/static/uploads/crop_cam_20260708_163731.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5c0ec5fa48ad1993ff073b6cd23f61fd084bb72e Binary files /dev/null and b/static/uploads/crop_cam_20260708_163731.jpg differ diff --git a/static/uploads/crop_cam_20260708_163748.jpg b/static/uploads/crop_cam_20260708_163748.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d68da654fa29c16fb6d47d60ddfd0b590891070d Binary files /dev/null and b/static/uploads/crop_cam_20260708_163748.jpg differ diff --git a/static/uploads/crop_cam_20260708_163818.jpg b/static/uploads/crop_cam_20260708_163818.jpg new file mode 100644 index 0000000000000000000000000000000000000000..398b6dd91a377dbd103485f01a272837dce636de Binary files /dev/null and b/static/uploads/crop_cam_20260708_163818.jpg differ diff --git a/static/uploads/crop_cam_20260708_163824.jpg b/static/uploads/crop_cam_20260708_163824.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9dfeb407fb2d99325ef889396c5d3a243314b659 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163824.jpg differ diff --git a/static/uploads/crop_cam_20260708_163830.jpg b/static/uploads/crop_cam_20260708_163830.jpg new file mode 100644 index 0000000000000000000000000000000000000000..584777ae7d904083bdbe293ea497a6f5211b26f7 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163830.jpg differ diff --git a/static/uploads/crop_cam_20260708_163837.jpg b/static/uploads/crop_cam_20260708_163837.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e0d3d2d1e55c1f47d6a80b7cd1bb437ada804641 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163837.jpg differ diff --git a/static/uploads/crop_cam_20260708_163847.jpg b/static/uploads/crop_cam_20260708_163847.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4c90a906ae76ea861b2489cbfa493f44d2117570 Binary files /dev/null and b/static/uploads/crop_cam_20260708_163847.jpg differ diff --git a/static/uploads/crop_cam_20260709_084845.jpg b/static/uploads/crop_cam_20260709_084845.jpg new file mode 100644 index 0000000000000000000000000000000000000000..79a43999d1a80d043906c193a8479c8e544c4373 Binary files /dev/null and b/static/uploads/crop_cam_20260709_084845.jpg differ diff --git a/static/uploads/crop_cam_20260709_085000.jpg b/static/uploads/crop_cam_20260709_085000.jpg new file mode 100644 index 0000000000000000000000000000000000000000..af80d75e822d2220c5aac502d7e012000a3dedb1 Binary files /dev/null and b/static/uploads/crop_cam_20260709_085000.jpg differ diff --git a/static/uploads/crop_cam_20260709_085021.jpg b/static/uploads/crop_cam_20260709_085021.jpg new file mode 100644 index 0000000000000000000000000000000000000000..16c527a92c96a2c949014942ab04c5b1d22ddff7 Binary files /dev/null and b/static/uploads/crop_cam_20260709_085021.jpg differ diff --git a/static/uploads/crop_cam_20260709_085046.jpg b/static/uploads/crop_cam_20260709_085046.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7fab6d7fe7384539f31ec59f6e52a49766b1301b Binary files /dev/null and b/static/uploads/crop_cam_20260709_085046.jpg differ diff --git a/static/uploads/crop_cam_20260709_085055.jpg b/static/uploads/crop_cam_20260709_085055.jpg new file mode 100644 index 0000000000000000000000000000000000000000..eb5a9c9e0711812af7f8eae31b40b1ffec1f538b Binary files /dev/null and b/static/uploads/crop_cam_20260709_085055.jpg differ diff --git a/static/uploads/crop_cam_20260709_085107.jpg b/static/uploads/crop_cam_20260709_085107.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c560ff43dabcd9f31a1c26e537f7b92d707dc2ac Binary files /dev/null and b/static/uploads/crop_cam_20260709_085107.jpg differ diff --git a/static/uploads/crop_cam_20260709_085116.jpg b/static/uploads/crop_cam_20260709_085116.jpg new file mode 100644 index 0000000000000000000000000000000000000000..66027d6dfeb14b420b6973520ec3bb8199017f3e Binary files /dev/null and b/static/uploads/crop_cam_20260709_085116.jpg differ diff --git a/static/uploads/crop_cam_20260709_085136.jpg b/static/uploads/crop_cam_20260709_085136.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b886651093f34dd4036379d99839b4213205893e Binary files /dev/null and b/static/uploads/crop_cam_20260709_085136.jpg differ diff --git a/static/uploads/crop_cam_20260709_085151.jpg b/static/uploads/crop_cam_20260709_085151.jpg new file mode 100644 index 0000000000000000000000000000000000000000..469bc55f745be287a10491cd7f41e8c4fc7100a1 Binary files /dev/null and b/static/uploads/crop_cam_20260709_085151.jpg differ diff --git a/static/uploads/crop_cam_20260709_085209.jpg b/static/uploads/crop_cam_20260709_085209.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1e75214045ea227b5c5f6d10e14ffbd9c4594983 Binary files /dev/null and b/static/uploads/crop_cam_20260709_085209.jpg differ diff --git a/static/uploads/crop_cam_20260709_085224.jpg b/static/uploads/crop_cam_20260709_085224.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3386c32c0802d0f943d4d7995bc7405118df22af Binary files /dev/null and b/static/uploads/crop_cam_20260709_085224.jpg differ diff --git a/static/uploads/crop_pevita_bare_face.width-800.format-webp.webp b/static/uploads/crop_pevita_bare_face.width-800.format-webp.webp new file mode 100644 index 0000000000000000000000000000000000000000..751b8abd8dc01914f1392b34eed876d2e0f69187 Binary files /dev/null and b/static/uploads/crop_pevita_bare_face.width-800.format-webp.webp differ diff --git a/static/uploads/pevita_bare_face.width-800.format-webp.webp b/static/uploads/pevita_bare_face.width-800.format-webp.webp new file mode 100644 index 0000000000000000000000000000000000000000..9542034edae338a3386e9391a79c38a518fefc08 Binary files /dev/null and b/static/uploads/pevita_bare_face.width-800.format-webp.webp differ