How rjtbst/productsnap works
Project Type & Purpose
• AdSnap Studio is a Streamlit-based, single-page web app (“frontend”) that orchestrates AI-driven image generation and manipulation (“backend”) by calling Bria AI’s external APIs.
• It has no database or long-term storage; it relies on in-memory workflows and external service calls.
File Structure
• Top-level:
• app.py – Streamlit entry point (UI + controller)
• requirements.txt / .env – dependency list and API key
• components/ – Streamlit UI widgets
• uploader.py, sidebar.py, image_preview.py
• workflows/ – orchestration logic
• generate_ad_set.py
• services/ – feature-specific modules that wrap Bria API calls
• erase_foreground.py, generative_fill.py, hd_image_generation.py, lifestyle_shot.py, packshot.py, prompt_enhancement.py, shadow.py
• utils/ – (future) shared helper functions
README Insights
• Core features correspond to service modules (background removal, prompt enhancement, shadows, lifestyle shots, HD generation).
• UI config options map directly to parameters fed into the orchestration logic in workflows/generate_ad_set.py.
Main Components & Their Relationships
a. User & Browser
– End user interacts via browser running the Streamlit UI.
b. Streamlit App (app.py + components/)
– Renders UI, captures user input, displays results.
c. Workflow Orchestrator (generate_ad_set.py)
– Central business logic: sequences calls to service modules based on UI settings.
d. Service Layer (services/*.py)
– Each module wraps calls to a specific Bria AI endpoint for image generation or manipulation.
e. External API (Bria AI)
– The “data store” / engine: HD generation, background removal, shadows, etc.
f. Configuration (.env)
– Supplies BRIA_API_KEY to service modules.
Data Flow:
User → Streamlit UI → Workflow → Service Modules → Bria API → Service Modules → Workflow → Streamlit UI → User
Architectural Patterns & Design Principles
• Layered Architecture:
• Presentation Layer (UI components)
• Application/Orchestration Layer (workflows)
• Service/Integration Layer (external API adapters)
• Single responsibility per service module.
• Clear separation: UI never calls Bria API directly; all calls pass through workflows and service wrappers.