← Code

Apps with Gradio

Turn Python functions into apps with inputs and outputs: a greeter, a calculator with several inputs, and a quiz built from a list of questions, in an in-browser stand-in for Gradio that runs the same code as the real thing.

Start1. Your first app

First apps

A function plus inputs and outputs makes an app; more inputs mean more parameters, in the same order.

1Your first appNot started

Turn a Python function into an app you can click, in an in-browser stand-in for Gradio that runs the same code as the real thing.

  1. Predict
  2. Run
  3. Investigate › No brackets
  4. Investigate › A tick box
  5. Investigate › Spot the bug
  6. Modify › How excited?
  7. Modify › A second output
  8. A tiny tool
  9. Where this leads
Start lesson
2More inputs, more outputsNot started

A movie-night calculator with sliders, a dropdown and two outputs: each input is a parameter, each output a returned value, all in order.

  1. Predict
  2. Run
  3. Investigate › What each input gives
  4. Investigate › Tidy numbers
  5. Investigate › Spot the bug
  6. Modify › Popcorn
  7. Modify › Seats
  8. Your own calculator
  9. Where this leads
Start lesson

A quiz app

Questions as data, an input made for each one, and a function that marks the answers.

3A quiz appNot started
4A class for questions OptionalNot started

Store each question as an object of your own class, Question, with a check method, so each question knows how to mark itself.

  1. Predict
  2. Run
  3. Investigate › Whose answer?
  4. Investigate › What mark lost
  5. Investigate › Spot the bug
  6. Modify › Hints
  7. Modify › Points
  8. Your quiz with objects
  9. Where this leads
Start lesson

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)