How greywarden07/handscriptart works
Project type and purpose
• This is a monolithic, full-stack web application (“HandScript Art”) built in Python/Flask with an embedded computer-vision pipeline.
• Purpose: accept an uploaded image, apply AI‐powered handwriting effects (Perlin noise, edge detection, geometric transforms), and return the “handwritten” output.
File structure
• Top level:
• app.py ← Flask web server & HTTP endpoints
• writing_artifact.py ← CLI entry point for the image-processing pipeline
• macro.py ← likely helper functions (e.g., Perlin noise, parameter presets)
• background/ ← static assets or textures fed into rendering
• templates/index.html ← front-end UI
• Dockerfile, docker-compose.yml ← containerization & deployment
• requirements.txt ← Python dependencies (Flask, OpenCV, NumPy, Pillow, etc.)
• No separate frontend framework—UI is served server-side via Jinja2 template.
• No external microservices—everything runs in one container.
README for additional insights
• Tech stack: Python 3.10+, Flask, OpenCV, NumPy, Pillow
• Core pipeline phases: preprocessing, edge detection, Perlin noise, geometric transforms, rendering
• Deployment: Docker Compose spins up one service (port 5000)
• CLI usage: writing_artifact.py provides direct access to the pipeline
a. Main components
1. Client Browser (User Interface)
2. Flask Web Server (app.py)
3. Image-Processing Module
– writing_artifact.py CLI & macro.py helpers
– OpenCV, NumPy, Pillow libraries
– background assets folder
4. Persistent Storage (uploads/, out/)
5. Container / Deployment Layer (Docker, Docker-Compose)
b. Relationships & interactions
• Browser → HTTP POST/GET → Flask Web Server
• Flask → calls → Image-Processing Module
• Image-Processing Module → reads/writes → Storage
• Flask → returns → Processed image URL → Browser
• Docker container wraps Flask + modules; Docker-Compose orchestrates service
c. Architectural patterns & design principles
• Monolithic, single‐service architecture
• Separation of concerns:
– Presentation (index.html)
– Application logic (app.py routing + parameter parsing)
– Business logic (writing_artifact.py + macro.py + CV algorithms)
• Reusable pipeline modules (CLI + Web)
d. Key technologies
• Flask for HTTP/API layer
• Jinja2 templates for UI
• OpenCV & NumPy for image processing
• Perlin noise & geometric transforms for effects
• Docker + Docker-Compose for containerized deployment