# Indic Heritage Studio v2 — System Architecture ## High-level diagram ``` ┌──────────────────────────────────────────────────────────────────────────────┐ │ USER INTERFACE (Gradio) │ │ │ │ Tab 1: Text→Image Tab 2: Style Transfer Tab 3: Image→Video │ │ Tab 4: ControlNet Tab 5: Inpainting Tab 6: Batch (multi-GPU) │ │ + AI Style Advisor widget (calls Qwen via free AMD API) │ └──────────────────────────────────┬───────────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────────────────────────────────────────┐ │ AGENT LAYER (free AMD Model API) │ │ │ │ StyleAdvisor → recommends heritage style (JSON) │ │ PromptEngineer → enriches prompt with style keywords (SDXL-aware) │ │ Critic → scores output, suggests regeneration │ │ │ │ LLM: Qwen3.6-35B-A3B (fallback: DeepSeek-V4-Flash) │ │ Endpoint: https://developer.amd.com.cn/radeon/api/v1 │ │ Cost: $0 — does NOT burn Radeon GPU credits │ └──────────────────────────────────┬───────────────────────────────────────────┘ │ (only when generation is needed) ▼ ┌──────────────────────────────────────────────────────────────────────────────┐ │ CORE GPU LAYER — MULTI-GPU (8 × NVIDIA 80GB dev / AMD Radeon final) │ │ │ │ GPU 0: SDXL 1.0 + DreamShaper-XL turbo (T2I + Inpainting) │ │ GPU 1: SDXL + IP-Adapter XL (Style transfer) │ │ GPU 2: Stable Video Diffusion XT 1.1 (Image → Video) │ │ GPU 3: SDXL + ControlNet (Canny/Depth/Pose)(Composition control) │ │ GPUs 4-7: 4 parallel batch workers (Batch processing) │ │ │ │ Per-style LoRAs (5 × ~150 MB) loaded on demand by all SDXL pipelines │ │ Hardware: 8 × NVIDIA A100/H100 80GB (dev) — AMD Radeon Cloud (final demo) │ │ Stack: PyTorch 2.4.1 + ROCm 6.2 + Diffusers 0.30 + PEFT 0.12 │ │ Cost: NVIDIA dev = $0; AMD final demo = ~2 of 10 credits │ └──────────────────────────────────────────────────────────────────────────────┘ ``` ## Rule compliance The Track 1 Rules & Conditions specify: - *"It is not allowed to rely solely on closed-source online APIs for core functions."* - *"At least one key inference process must run locally on AMD Radeon GPU."* Indic Heritage Studio v2 complies on every axis: - **All 6 core pipelines** (T2I, style transfer, I2V, ControlNet, inpainting, batch) run 100% on AMD Radeon GPU during the final demo + benchmark. - **Agent layer** (Qwen/DeepSeek) is *optional UX enrichment* — the studio works fully even if the AMD Model API is down. Each agent has a deterministic fallback (`agents/*.py`). - **Per-style LoRAs** are trained locally on NVIDIA hardware (free) and loaded at inference time on AMD Radeon — the LoRA weights are committed to the repo, so AMD doesn't need to retrain anything. ## Module dependency graph ``` config/settings.py ─────────────┐ config/styles.py ───────────────┤ ├──> agents/base.py ──> agents/style_advisor.py │ ├─> agents/prompt_engineer.py │ └─> agents/critic.py │ ├──> core/text_to_image.py ──> uses agents/prompt_engineer + per-style LoRA ├──> core/style_transfer.py ──> uses IP-Adapter XL + per-style LoRA ├──> core/image_to_video.py ──> Stable Video Diffusion ├──> core/controlnet.py ──> Canny / Depth / OpenPose ├──> core/inpainting.py ──> SDXL Inpainting └──> core/batch_processor.py ──> uses core/text_to_image OR core/style_transfer │ └──> ui/gradio_app.py │ └──> app.py training/prepare_dataset.py ──> assets/datasets/