Ben_Kosytorz aefdcb38de refactor(api): simplify actix_web imports and remove unused modules
- Removed unused imports (Scope, Arc, Mutex) from api/mod.rs
- Updated config function signature to use ServiceConfig instead of Scope
- Removed unused session_manager module from main.rs
- Cleaned up documentation comments in models and queue_service modules
- Simplified import statements across backend modules for better readability

This refactoring removes unnecessary dependencies and cleans up the codebase by eliminating unused imports and redundant documentation while maintaining all functionality.
2026-03-03 00:08:58 +01:00
vim
2026-03-02 23:06:24 +01:00
2026-03-02 23:30:14 +01:00
2026-03-02 22:27:15 +01:00
vim
2026-03-02 23:06:24 +01:00

ComfyUI-like Framework - Rust & React Implementation with ROCm Support for RX 9070 XT

Project Overview

This project implements an AI image/video generation tool inspired by the node-based workflow editor of Stable Diffusion Web UI. Built as a modern web application using:

  • Backend: Pure Rust (Actix-web framework)
  • Frontend: React + TypeScript with Node graph visualization
  • GPU Acceleration: ROCm integration for AMD RX 9070 XT GPU

Key Features:

  1. REST API for model inference requests
  2. 🔄 ROCm integration on AMD RX 9070 XT GPU
  3. ⚙️ Task queue system using Tokio async runtime (Rayon parallelism)
  4. 💾 File upload/download support with session management

Architecture Design:

┌─────────────────────┐    WebSocket     ┌──────────────────┐
│  React Web Frontend │◄═══► progress   │ Rust Backend API ├─▶ ROCm GPU (RX9070XT)
│ - Node Graph Editor |                    ├── Inference Queue|
│ - Workflow Builder  |                      ◄──── Models      |
╰─────────────────────╯    REST/JSON     └────────┬──■═══►
                                           │    
                                       Session/JWT Auth   

Setup Instructions

Prerequisites:

  • Rust toolchain (cargo)
  • Node.js & npm/yarn/pnpm
  • AMD ROCm installed for RX 9070 XT GPU acceleration
# Install dependencies if needed on Linux/AMD systems:

sudo apt-get update && sudo apt install -y build-essential cmake ninja-build libopenblas-dev

ROCm installation (run as user with appropriate permissions):
wget https://repo.radeon.com/amd-install/latest/install.sh  
chmod +x amd-install/install.sh
./amd-install/install.sh --no-dkms  # Skip DKMS if AMD driver is already installed system-wide for RX9070XT  

# Verify ROCm installation:
rocminfo    # Should show your GPU info including "gfx900" or similar architecture

Backend Setup (Rust):

cd ComfyUI-Rust/backend  
cargo build --release  # For production builds, use release mode for better performance on AMD GPUs  

# Run the backend server:
./target/release/comfyui-backend-server [port]

Backend runs at: http://localhost:[PORT]
API endpoints available after starting.

Frontend Setup (React):

cd ComfyUI-Rust/frontend  
npm install  # Install dependencies

Run dev mode with hot reload and AMD GPU preview support:
yarn start  

# Production build for deployment on ROCm systems: 
RUST_AMD_ROCM_PATH=/usr/local/AMDROCmlib yarn run prod-build && npm run serve

Project Structure Overview:

Rust Backend (backend/src):

- src/main.rs            # Entry point & server configuration  
  - Actix-web app setup, CORS middleware for frontend access
  
src/
├── api/mod.rs          # REST API endpoint handlers (inference requests)
   POST /api/infer     # Start inference on ROCm GPU

 ├── models/           # ML model loading and management
     └── stable_diffusion_loader.cpp  

 ├─ queue_service       # Task Queue using Tokio + Rayon for parallel tasks  
  - Parallel task scheduling across available CPU cores & AMD threads
  
├── rocminfo.rs        # ROCm GPU detection on RX9070XT hardware 
                      
 └──── session_manager   JWT/Session authentication middleware  

Frontend Web App (frontend/src):

src/
 ├─ components/node-editor.tsx    // Node-based workflow editor (graph canvas)
  - Drag & drop node positioning on AMD GPU-aware preview panel
  
├── store/graph-store.js         # Redux state management for nodes
│                              │

 └──── utils/api-client          API calls to Rust backend server  

ROCm Integration Notes:

Key Components:

  • tokio async runtime: Handles concurrent inference tasks efficiently
    • Parallelism configured based on AMD GPU thread count (RX9070XT)
// Example configuration from rust/backend/src/config.rs

pub struct Config {
    pub gpu_backend_config = RocmConfig { // ROCm detection for RX900 series GPUs
    

Development Workflow:

  1. Model Preparation:

    • Download/prepare Stable Diffusion checkpoints (.safetensors)
  2. Backend API Testing:

curl http://localhost:8080/api/infer \
  --header "Content-Type: application/json" \ 
--data '{"prompt":"A futuristic cityscape","negative_prompt":"","guidance_scale":7,"steps":20}'
  1. Web Frontend Usage:

  2. ROCm GPU Acceleration is automatically detected and used when available.

API Endpoints:

Backend REST API

  • GET /health - Health check endpoint
  • GET /system-info - Get system and GPU information
  • POST /infer - Start a new inference task
  • GET /models - List all available models
  • GET /tasks/{task_id} - Get status of specific task
  • GET /tasks - List all tasks

Example Request:

curl http://localhost:8080/api/infer \
  --header "Content-Type: application/json" \ 
  --data '{"prompt":"A futuristic cityscape","negative_prompt":"","guidance_scale":7,"steps":20}'

Troubleshooting:

Common Issues with Ryzen/AMD Setup:

  1. Permission denied accessing /dev/kfd → Add user to render, video groups
sudo usermod -aG render,audio $USER && sudo gpasswd --add $(whoami) audio

  1. ROCm not detected: Check AMD driver version for RX9070XT:

rocminfo | grep gfx900 # Should show architecture detection

```bash
# Reboot after installing/updating drivers  
sudo reboot  


## License & Contributing:

This project follows open-source best practices with community contributions welcome.

---

**Built specifically to leverage AMD RX9070 XT GPU capabilities through ROCm framework for accelerated AI inference.**
Description
Vibecoded Webui for picture generation with ai.
Readme GPL-3.0 3.6 GiB
Languages
Rust 100%