gr.Interface class can handle four different kinds of demos, depending on whether you need inputs, outputs, or both.
Interface types overview
Gradio supports:- Standard demos - separate inputs and outputs (e.g., image classifier, speech-to-text)
- Output-only demos - no input, only output (e.g., unconditional image generation)
- Input-only demos - no output, only input (e.g., save uploads to database)
- Unified demos - same components for input and output (e.g., text autocomplete)
Standard demos
Standard demos have both input and output components. Set both theinputs and outputs parameters:
- 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. Setinputs=None:
- 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. Setoutputs=None:
- 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.- 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
Standard interfaces
Use when you have a clear transformation: input → processing → outputMost common type for machine learning models.
Output-only interfaces
Use when your function generates content without user inputPerfect for generative models that don’t need conditioning.
Input-only interfaces
Use when you need to collect data without showing resultsGreat for data collection, logging, or backend operations.
Beyond the four types
If none of these types fit your needs, you’ll want to usegr.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
Complete examples
Standard: Image classifier
Standard: Image classifier
Output-only: Random image generator
Output-only: Random image generator
Input-only: Feedback collector
Input-only: Feedback collector
Unified: Text editor
Unified: Text editor
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