Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Showcase of the results

Flask photo enhancing web aplication

A simple web application built with Flask that allows users to upload and enhance their images using the Real-ESRGAN neural network for high-quality upscaling.

Users can register, log in, and view their enhanced images in a personal gallery. The backend uses PyTorch, SQLAlchemy, and OpenCV, with image enhancement powered by Real-ESRGAN.


🧩 How to Run

Follow these steps to run the Real-ESRGAN Flask app inside a Docker container with GPU support.

⚙️ 1. Requirements

Before running, make sure you have:

To verify that Docker sees your GPU, run: docker run --rm --gpus all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi If you see your GPU info (driver version, memory, etc.) — you’re good to go!

🧠 2. Download the Pretrained Model

Download the Real-ESRGAN model file and place it in the models/ folder: https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth

3. Create .env File

In the project root directory, create a .env file containing your secret key: SECRET_KEY=some-random-secret-key

This key is used by Flask for session encryption — make sure it stays private.

🐳 4. Build the Docker Image

Run the following command in the root of the project: docker-compose up -d --build

🌐 5. Access the App

Once running, open: http://localhost:5000


🚀 Features

  • 🐳 Fully containerized with Docker Compose
  • 🧍 User authentication (register, login, logout)
  • 🖼️ Image upload and automatic verification (JPEG and PNG only)
  • ⚙️ Image enhancement using Real-ESRGAN (x4 upscaling)
  • 💾 SQLite database integration via SQLAlchemy ORM
  • 🗂️ Separation of uploaded and enhanced image storage
  • 🔒 Password hashing with Flask-Bcrypt
  • 🧩 Template-based frontend (HTML + Flask templates)

🧠 Tech Stack

Layer Technology
Backend Flask (Python)
Deep Learning Real-ESRGAN (RRDBNet)
Database SQLite + SQLAlchemy
Frontend Flask Templates (HTML, Jinja2)
Auth Flask-Login
Image Processing OpenCV, Pillow
Environment Python 3.9+

⚙️ How it Works

  1. User registration/login Users can create an account and securely log in using hashed passwords.

  2. Image upload Uploaded files are verified with Pillow (PIL.Image.verify()) to prevent invalid or corrupted inputs.

  3. Image enhancement Real-ESRGAN processes the image via the RealESRGANer.enhance() method, performing x4 super-resolution.

  4. Result storage Both original and enhanced images are saved in separate folders and linked to the user in the SQLite database.

  5. Gallery view Logged-in users can see all their previously enhanced images on the home page.


About

none

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages