from flask import Flask, request, render_template_string
from PIL import Image
import numpy as np
import io
import base64
import torch
import torchvision.transforms as transforms
import os
import sys
import time
app = Flask(__name__)
# Add paths for different methods
sys.path.append('.') # For ZeroIG (root folder)
sys.path.append('./CFWD') # For CFWD method
HTML_TEMPLATE = """
Multi-Method Low-Light Enhancement
🌟 Multi-Method Low-Light Enhancement
Professional low-light image enhancement with multiple state-of-the-art methods
📁 Method Status:
{{ method_status }}
📚 Select Enhancement Method:
🎯 ZeroIG: Zero-shot illumination-guided joint denoising and adaptive enhancement.
Fast processing, no training data required, prevents over-enhancement artifacts.
🌊 CFWD: CLIP-Fourier Guided Wavelet Diffusion for low-light enhancement.
Uses diffusion models with CLIP guidance for state-of-the-art quality.
🔄 Comparison Mode: Process with both methods to see the differences.
Takes longer but shows you the best of both approaches side-by-side.