JunoJR Learning
← AI Lab
Chapter 9 · Advanced · 75 min

Build an Interface People Can Use

Wrap your AI in something others can try.

In this chapter you'll

  • Understand why an interface matters
  • Turn a Python function into a web app with Gradio
  • Get a shareable link others can actually use
  • Customize your app's look and personality

🛠️ You'll build: Your AI helper as a real web app with a shareable link you can send to a friend or family member.

Your agent from Chapter 8 is powerful — but right now only you can use it, by running code. To make something people can actually use, it needs an interface: a box to type in and a button to press, no code required.

You'll build one in a few lines using Gradio, a tool that turns a Python function into a web app — and even gives you a link to share.

Why interface matters

The smartest AI in the world is useless if nobody can reach it. An interface is the bridge between your clever code and a real person. Great engineers always ask: "How will someone actually use this?"

Step 1 — Install Gradio

In a Colab cell:

!pip install gradio

Step 2 — Wrap your AI in a web app

Take the ask-style function you already know, and hand it to Gradio:

import gradio as gr

def ask(question):
    message = client.messages.create(
        model="claude-haiku-4-5",
        max_tokens=300,
        system="You are a friendly helper for kids. Keep answers short and clear.",
        messages=[{"role": "user", "content": question}],
    )
    return message.content[0].text

demo = gr.Interface(
    fn=ask,                                   # the function to run
    inputs=gr.Textbox(label="Ask me anything"),
    outputs=gr.Textbox(label="Answer"),
    title="My AI Helper 🤖",
    description="Type a question and press Submit!",
)

demo.launch(share=True)

That's the whole app! gr.Interface builds the page; fn=ask says "when someone submits, run this function." Press play.

Step 3 — Get your shareable link

Because you used launch(share=True), Gradio prints two links:

  • a local one (just for you), and
  • a public one (ends in .gradio.live) — anyone with this link can use your app in their browser.

Send the public link to a friend or family member and watch them use the thing you built. 🎉

Stay safe

That public link is real and open to anyone who has it, and every use spends a little of your account's credit (it's your API key behind the scenes).

  • Only share it with people you trust — not on public websites or social media.
  • The link is temporary — it stops working after a while, or when you stop the Colab cell. That's good: stop the app when you're done sharing.
  • Never put secrets (like your API key) into the app's text boxes.

Check yourself

  • Why does an AI app need an interface?
  • What does launch(share=True) give you that a normal program doesn't?
  • Why should you only share your link with people you trust?

Project — Ship your helper 🛠️

  1. Take your helper from Chapter 7 or 8 (your riddle master, tutor, joke bot) and put its system prompt into the ask function above.
  2. Give the app a fun title and description.
  3. Launch it and share the link with someone. Ask them what they'd improve.
  4. In your "My AI Helpers" doc, paste a screenshot or note what you built. You shipped a real app! 🚀

Your turn

Add example questions so people know what to try — Gradio makes it easy:

demo = gr.Interface(
    fn=ask,
    inputs="text",
    outputs="text",
    title="My AI Helper 🤖",
    examples=["Tell me a space fact", "Explain photosynthesis simply", "Give me a riddle"],
)
demo.launch(share=True)

Click an example to auto-fill it. Small touches make an app feel finished.

Make it simpler · ages 9–11

With a grown-up, just run the example app and share the link so a family member can try it. Watching someone else use your AI is the best part — you made a real app people can use!

Level up · ages 13–16

Make it a chat app with memory (from Chapter 8) using gr.ChatInterface, or add a second input (like a dropdown to pick the AI's personality). Then look up Gradio on Hugging Face Spaces with a guardian — it's a free way to host your app permanently so the link never expires. That's real deployment.

What you learned

  • An interface is how real people use your AI — no code needed.
  • Gradio turns a Python function into a web app in a few lines.
  • launch(share=True) gives you a public link to share.
  • You shipped an app other people can actually use. 🎉

You've earned the App Builder badge. 🏅

You now have every skill an AI engineer needs: prompting, training models, coding, agents, and interfaces. Time to put it all together into something that's truly yours — the Chapter 10 Capstone.

🏅 Finish this chapter to earn the App Builder badge.