Skip to content

Summary: Build and share a demo

Phase 3 opens by shipping. A Gradio demo turns a model into a browser app a non-coder can try, with no frontend code. The whole thing is gr.Interface(fn, inputs, outputs) plus launch(): fn is any Python function (in an AI app, it calls your model), and inputs/outputs are the component types. To demo a model you put your inference code in fn. Components describe the model’s input and output (gr.Textbox, gr.Image, gr.Audio, and more), so matching them defines the demo. To share, launch(share=True) gives a temporary public link that runs on your machine; for a permanent home, push an app.py and requirements.txt to Hugging Face Spaces and the Hub hosts it for free. This is the scan version; the lesson builds and launches a real demo.

  • A demo is gr.Interface(fn, inputs, outputs) plus launch(). Three arguments and one call produce a working web app. fn can be any function.
  • To demo a model, put inference in fn. Load a pipeline or model, write a function that runs it on the input, point Interface at that function. Everything from earlier lessons plugs in.
  • Components match the model’s input and output. "text" gives defaults; instantiate gr.Textbox, gr.Image, gr.Audio, gr.Label, etc. to customize and to handle non-text models. The components define the type of demo.
  • launch(share=True) is the quick share: a temporary public URL (about 72 hours) tunneling to your machine, alive only while your code runs.
  • Hugging Face Spaces is the permanent home: an app.py plus requirements.txt pushed to a Space, hosted free at a stable URL on the Hub’s own machine.
  • Blocks is the escape hatch. Use the lower-level Blocks API only when Interface cannot express your layout.

This lesson collapses the gap between a model that works and a model people use. That gap used to mean a frontend engineer, a backend, and a deployment; Gradio plus Spaces makes it a few lines and a Git push, which changes what you can accomplish alone. You can get feedback from a non-technical stakeholder in an afternoon, hand a domain expert something to break, or put a result in front of the public, all without leaving Python. A demo is also an honesty check: a model that looked great on a metric often shows its rough edges the moment a real person types something unexpected, which is the feedback that makes the next iteration better. Shipping is not an afterthought; it is how a model meets reality. With a demo built, the track turns to the LLM-specific frontier.

You do not need a frontend team to put a model in front of people. A few lines of Gradio and a Space turn the thing in your notebook into a link anyone can open, which is how a model stops being a private result and becomes a tool.