Principle:Haotian liu LLaVA Gradio Web Interface
Overview
Web-based user interface pattern for interactive multimodal chat with image upload and streaming responses.
Description
The Gradio web interface provides a browser-based chat UI for interacting with LLaVA models. It serves as the user-facing frontend in the distributed controller-worker architecture.
Key capabilities:
- Controller integration -- Connects to the controller to discover available models and route inference requests.
- Image upload -- Users can upload images directly in the chat interface for visual question answering.
- Streaming responses -- Responses stream in real-time using server-sent events (SSE), providing immediate feedback.
- Multi-turn conversation -- Supports multi-turn dialogue with image context maintained across turns.
- Model selection -- A dropdown menu allows users to select from all models available across registered workers.
- Configurable generation parameters -- Sliders for temperature, max output tokens, and top-p sampling.
- Response quality feedback -- Upvote, downvote, and flag buttons allow users to rate response quality for data collection.
Usage
Deploy as the user-facing frontend for the LLaVA demo. The Gradio web server requires:
- A running controller (to discover workers and route requests)
- At least one running model worker (to serve inference requests)
The typical deployment order is:
- Start the controller
- Start one or more model workers
- Start the Gradio web server
Theoretical Basis
The UI follows a server-sent event (SSE) streaming pattern:
- The user submits a message (with optional image).
http_bot()sends a POST request to the controller's/worker_generate_streamendpoint.- The controller proxies the request to a selected worker.
- The worker generates tokens and streams them back.
http_bot()yields partial responses as they arrive, updating the chat display in real-time.
Image transport: Images are base64-encoded for HTTP transport between the Gradio frontend and the controller/worker backend.
Metadata
| Field | Value |
|---|---|
| Knowledge Sources | Repo - LLaVA - https://github.com/haotian-liu/LLaVA |
| Domains | Web_Interface, Model_Serving |
| Last Updated | 2026-02-13 14:00 GMT |