How To Gradio: Understanding the basics of gradio.Interface — Parameter (title= “add app title”)

HuggyMonkey
3 min readNov 16, 2023

gradio.Interface is the main class used to build the UI using the Gradio library. In a few lines of code, you can create a web app for machine learning models, chatbots, dashboards, practically whatever your imagination can spin up. If you can translate your idea into a Python function, Gradio can handle the presentation.

In this series, Understanding the basics of gradio.Interface, we are going to help you understand as simply as possible the key concepts of using the gradio.Interface class. We will also discuss the class’s most important parameters and methods so that you can improve your app-building skills with Gradio.

Parameter (title= “add Gradio app name”)

In this article, we will demonstrate how to use one of the “descriptive parameters” of the gradio.Interface class: ‘title=’. The descriptive parameters of the gradio.Interface class (title=, description=, and article=), allows you to provide additional information to the users such as the App’s name, description, instructions, disclaimers, and any other relevant information you wish to convey to the users of the app.

Getting Started With Gradio

To get started with Gradio, simply install Gradio from PyPi via pip

pip install gradio

How To Add A Title/Name To Your Gradio App

The gradio.Interface(title=) parameter expects a str. You can simply pass the title/name of your app as a str.

Image adapted from https://www.gradio.app/docs/interface

Above is the description of the gradio.Interface class “title” parameter according to the official documentation found here.

There are a few highlighted points to consider when setting the title of your app. Let’s have a look at these points:

“a title for the interface; if provided, appears above the input and output components in large font.”

import gradio as gr

def greet(name):
greeting = "Hello " + name
return greeting

app = gr.Interface(fn=greet,
inputs=gr.Textbox(),
outputs=gr.Textbox(),
title="Hello 'Name' App", # <--- Title/Name of app passed as str
)

app.launch()

“Also used as the tab title when opened in a browser window.”

As you can see it’s quite simple to add a title/name for your Gradio app. Simple pass the app’s name as a str to the gradio.Interface ‘title=’ parameter.

Hopefully after reading, you now understand:

  • How to add a title/name to your Gradio app

If you would like to practice building with Gradio, you can do so right in your browser for free at the Gradio Playground.

Read the official Gradio documentation regarding the gradio.Interface class here.

Read more in the series Understanding the basics of gradio.Interface.

--

--