waveshaker's picture
Update README.md
4fda6e7 verified
|
Raw History Blame Contribute Delete
4.42 kB
---
title: πŸ“ UNIVERSAL LORA STUDIO - GUI(TEST)
emoji: πŸ§ͺ
colorFrom: gray
colorTo: pink
sdk: static
pinned: false
---
---
<div align="center">
<h1>⚑ Universal LoRA Studio - GUI Client</h1>
<p><i>A lightning-fast native UI that performs secure ZeroGPU token handshakes, polls backend generation metrics in real-time, and renders character galleries with physical spring animations.</i></p>
</div>
---
### βš™οΈ System Architecture
This Space is a 100% native, lightweight Static Web UI (HTML/CSS/JS) designed to serve as the frontend for the [**🎨Universal Model Character LoRA Studio**](https://huggingface.co/spaces/waveshaker/universal-lora-studio) backend. To overcome Hugging Face's cross-space CORS restrictions and manage ZeroGPU billing securely, it utilizes a highly decoupled "Proxy-Driven" architecture.
#### πŸ—οΈ System Topology (Frontend Perspective)
| Layer | Core Components | Role & Responsibility |
| :--- | :--- | :--- |
| **πŸ–₯️ UI Client**<br/>(This Space) | β€’ **Native HTML/JS**<br/>β€’ **Physics Animations**<br/>β€’ **State Locks** | Renders the gallery, handles smooth spring animations, and manages the complex UI state without heavy frameworks. |
| **πŸ” Auth & Token**<br/>(Browser Window) | β€’ **MessageChannel**<br/>β€’ **Timeout Fallback** | Communicates securely with the HF parent window to extract the `x-ip-token` for ZeroGPU billing. |
| **🌐 API Interface**<br/>(Cross-Origin) | β€’ **Fetch / REST**<br/>β€’ **100ms Polling**<br/>β€’ **Error Handling** | Submits payloads to the remote backend, intercepts real-time JSON logs, and gracefully handles backend wake-up delays. |
| **πŸ–ΌοΈ Media Pipeline**<br/>(Client Side) | β€’ **WebP Render**<br/>β€’ **Cache Busting**<br/>β€’ **EXIF Metadata** | Fetches the final physical image URL, handles cache-busting query params, and displays the generated result. |
#### πŸ”„ Request Lifecycle
```text
[User] ──(Access via Browser)──► [This Native Studio UI]
β”‚
β”œβ”€β–Ί 1. Handshake with HF Parent (Extract x-ip-token)
β”‚
β–Ό
[Submit POST /api/generate]
β”œβ”€β”€ Validate Dimensions (Frontend)
β”œβ”€β”€ Attach Token
└── Handle UI Loading States
β”‚
β–Ό
[Poll GET /api/status/{id}]
β”œβ”€β”€ Parse real-time logs & metrics
β”œβ”€β”€ Animate progress via requestAnimationFrame
└── Render final WebP image
```
#### πŸ“ One-Sentence Summary
> A lightning-fast native UI that performs secure ZeroGPU token handshakes, polls backend generation metrics in real-time, and renders character galleries with physical spring animations.
---
### πŸ› οΈ Key Frontend Features
Building the UI from scratch with native JS allowed us to bypass the heavy overhead of frameworks (like React or Vue) and integrate directly with the ZeroGPU lifecycle.
- **πŸ” Seamless ZeroGPU Auth**: Implements a `MessageChannel` handshake with the HF parent window to securely extract the `x-ip-token`. Includes a 2-second timeout fallback and a dynamic warning toast for anonymous quota users.
- **⚑ Real-Time Log Interceptor**: Features a highly optimized polling mechanism (100ms interval) that parses raw JSON metrics from the ComfyUI backend, categorizes them into pipeline stages (Queueing, Model Loading, Sampling), and prints them with animated typewriter effects.
- **πŸͺ„ Physics-Based Animations**: The character gallery features custom spring animations (`stiffness: 280`, `damping: 0.7`) calculated via `requestAnimationFrame`. No CSS keyframes, no external librariesβ€”pure, buttery-smooth 60fps rendering.
- **πŸ›‘οΈ State & Concurrency Locks**: Employs an `isGalleryFetching` mutex and intelligent DOM diffing (Smart Scroll & Debounce) to prevent UI flickering and API spam during rapid architecture switches (e.g., MOSS β†’ FLUX).
---
### πŸ”— Ecosystem Links
- πŸ–ΌοΈ **[Browse the LoRA Gallery](https://huggingface.co/spaces/waveshaker/loras_gallery)** - Explore 1000+ community characters.
- πŸ“Š **[Dataset](https://huggingface.co/datasets/waveshaker/dataset_collections)**
<div align="center">
<sub>Engineered by <b>waveshaker</b>. </sub>
</div>