TLDRocket
Sign in

Any Custom Frontend with Gradio's Backend

Hugging Face

Gradio just shipped a way to plug any custom frontend—React, Svelte, plain HTML—into its backend engine. That means devs get Gradio's queuing, GPU handling, and Spaces hosting without being stuck with Gradio's own UI components.

Based on reporting by Hugging Face — read the original for the full story.

Summary, retelling and take written by AI under human oversight; images are AI-generated illustrations. How we work · Report an error

Hugging Face has been pushing Gradio past its comfort zone lately, and the latest move is arguably the biggest one yet: gradio.Server. The pitch is simple. Keep Gradio's backend machinery—queuing, concurrency control, ZeroGPU allocation, gradio_client compatibility—but throw out the constraint that your UI has to be built from Gradio components.

To prove the point, the team built Text Behind Image, a browser tool that removes the background from a photo using the BiRefNet segmentation model, then lets you slide stylized text between the subject and the background, complete with 3D extrusion, perspective tilt, drop shadows, and 25-plus fonts. That's the kind of layered, drag-and-drop interface that simply can't be expressed with Gradio's built-in sliders and blocks. So instead of forcing it, they wrote a roughly 1,300-line vanilla HTML/CSS/JS frontend with zero React, zero build step, and paired it with a backend of about 50 lines of Python.

The trick sits in gradio.Server itself, which extends FastAPI rather than replacing it. You get normal FastAPI routes for serving static files—an @app.get("/") handler just returns the index.html—alongside a new @app.api() decorator that wraps any function in Gradio's queuing engine. That matters because GPU endpoints without concurrency control fall over the moment two people hit them simultaneously. With @app.api(), requests queue up properly, @spaces.GPU handles ZeroGPU allocation automatically, and the same endpoint becomes callable from gradio_client, so other scripts or apps can hit your Space's API without touching the frontend at all.

On the client side, the frontend doesn't use a plain fetch() call to reach the backend. It goes through the Gradio JS client, connecting to the Space's own origin and calling the /remove_background endpoint directly. That one choice is what keeps everything inside Gradio's queue rather than bypassing it, which means GPU requests don't collide even under load, and there's room to surface things like queue position down the line.

Hugging Face frames this as removing a false choice: previously you either took Gradio's infrastructure and its component-based UI, or you left for a custom frontend and built your own backend plumbing from scratch. gradio.Server says you don't have to pick. The live demo, ysharma/text-behind-image, is up on Spaces now, and the team has already teased follow-ups covering MCP tool registration, SSE streaming, and multi-page apps with shared state.

My take — AI-written commentary, not fact-checked reporting

This is Hugging Face quietly turning Gradio into a real backend framework, not just a demo-slapping tool, and it's a smart move because the biggest complaint about Gradio was always 'looks like Gradio.' Letting people keep ZeroGPU and queuing while ditching the component system removes the actual reason serious teams walked away to build custom apps on bare FastAPI. I'd bet this quietly becomes the default way people ship ML-backed Spaces within a year.

Read more about this at: Hugging Face

Related stories

The daily briefing

Every AI story that matters, in your inbox by 8am.

TLDRocket reads all relevant sources, removes duplicate coverage, and summarises the day in two minutes. Follow companies and topics for alerts, or get the briefing in Slack. Free, no spam, unsubscribe anytime.