The project's README from github.com/AhmadHassan-BTed/VisioCraft. As one markdown file: README.md.
VisioCraft AI is an advanced, AI-powered application for object extraction, context-aware background fill, and seamless image composition. It leverages state-of-the-art models for segmentation, detection, and generative inpainting.
VisioCraft has been refactored into a clean, modular architecture to ensure scalability and maintainability.
VisioCraft/
├── app/
│ ├── domain/ # Core business logic and data interfaces (Models, Interfaces)
│ ├── infrastructure/ # External integrations (Detection, Generation, Inpainting, Segmentation)
│ ├── routes/ # API Endpoints (Auth, Composition, Health, Uploads, etc.)
│ └── services/ # Application workflow and logic managers
├── models/ # Local AI models (e.g., mobile_sam.pt, yolov8n.pt)
├── static/ # Static assets (CSS, JS, background images)
├── templates/ # Frontend HTML templates
├── config.py # Centralized configuration settings
├── main.py # Application entry point
├── requirements.txt # Project dependencies
└── README.md # Project documentation
(Note: Older monolithic components have been transitioned to the new app/ module system)
Make sure you have Python 3.8+ installed.
# It is recommended to use a virtual environment
python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On Linux/Mac:
source .venv/bin/activate
pip install -r requirements.txt
Download the necessary AI models for local inference (like Mobile SAM and YOLO).
python download_models.py
You can set up environment variables for API keys to use advanced cloud-based AI generation.
export OPENAI_API_KEY="your_openai_api_key"
export HUGGINGFACE_TOKEN="your_huggingface_token"
export STABILITY_API_KEY="your_stability_api_key"
(Note: For Windows PowerShell, use $env:KEY="value" instead of export)
Start the VisioCraft server:
python main.py
Open your modern web browser (Chrome recommended) and navigate to http://localhost:5000.
| Method | Description | Characteristics |
|---|---|---|
| Stable Diffusion | Cloud/API-based generation | ⭐ Best Quality, Highly context-aware |
| OpenCV | Fast, local edge blending | Instant speed, Emergency fallback |
| Mobile SAM | Local AI segmentation model | Accurate object masking |
| YOLOv8 | Local Object Detection | Fast and robust bounding boxes |
.gitignore.config.py. Always rely on environment variables (.env or system variables) for sensitive tokens (e.g., HUGGINGFACE_TOKEN, STABILITY_API_KEY).