Skip to main content
The gr.Interface class can handle four different kinds of demos, depending on whether you need inputs, outputs, or both.

Interface types overview

Gradio supports:
  1. Standard demos - separate inputs and outputs (e.g., image classifier, speech-to-text)
  2. Output-only demos - no input, only output (e.g., unconditional image generation)
  3. Input-only demos - no output, only input (e.g., save uploads to database)
  4. Unified demos - same components for input and output (e.g., text autocomplete)
Depending on the type, the user interface looks different: Interface types visualization

Standard demos

Standard demos have both input and output components. Set both the inputs and outputs parameters:
This creates a standard interface with:
  • Input component on the left
  • Submit button
  • Output component on the right

Common use cases

  • Image classification
  • Text translation
  • Speech-to-text transcription
  • Question answering
  • Image-to-image transformations

Output-only demos

Output-only demos don’t take any input but produce output. Set inputs=None:
The interface shows:
  • A “Generate” button (instead of “Submit”)
  • Only the output component
  • No input components

Common use cases

  • Unconditional image generation (GANs)
  • Random quote generators
  • Daily predictions
  • Noise generation
  • Any function that requires no user input

Input-only demos

Input-only demos take input but produce no visible output. Set outputs=None:
The interface shows:
  • Only input components
  • A submit button
  • No output components

Common use cases

  • Save uploads to a database
  • Submit feedback forms
  • Log data for analytics
  • Trigger external processes
  • Any function where the output isn’t meant for display

Unified demos

Unified demos use the same component for both input and output. The output overwrites the input:
To create a unified interface, set inputs and outputs to the same component instance.
Here’s the correct way:
The interface shows:
  • A single component that serves as both input and output
  • Output replaces the input when function completes
  • Useful for iterative transformations

Common use cases

  • Text autocomplete/generation
  • Image enhancement (input image → enhanced image)
  • Code formatting/refactoring
  • Translation with same text box
  • Any iterative refinement task

Detecting interface type

Gradio automatically detects the interface type based on your configuration:

When to use each type

1

Standard interfaces

Use when you have a clear transformation: input → processing → outputMost common type for machine learning models.
2

Output-only interfaces

Use when your function generates content without user inputPerfect for generative models that don’t need conditioning.
3

Input-only interfaces

Use when you need to collect data without showing resultsGreat for data collection, logging, or backend operations.
4

Unified interfaces

Use when input and output are the same type and output should replace inputBest for iterative refinement or enhancement tasks.

Beyond the four types

If none of these types fit your needs, you’ll want to use gr.Blocks() instead, which provides:
  • Multiple functions with different input/output combinations
  • Custom layouts and arrangements
  • More complex interactivity
  • Conditional visibility
  • State management across multiple components
See the Blocks documentation for more advanced use cases.

Complete examples

Next steps

Interface class

Learn more about the Interface class

Blocks

Build more complex interfaces with Blocks

Examples

Working with examples in interfaces

Reactive interfaces

Create live and streaming interfaces