Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 64% confidence
Engineering Computer Science - 60% confidence
Earth and Environmental Sciences Physical Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: kzon94
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 686 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 10 months ago · Last pushed 10 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

gradio
Gradio 5.0 - the easiest way to build AI web apps | Product Hunt gradio-app%2Fgradio | Trendshift [![gradio-backend](https://github.com/gradio-app/gradio/actions/workflows/test-python.yml/badge.svg)](https://github.com/gradio-app/gradio/actions/workflows/test-python.yml) [![gradio-ui](https://github.com/gradio-app/gradio/actions/workflows/tests-js.yml/badge.svg)](https://github.com/gradio-app/gradio/actions/workflows/tests-js.yml) [![PyPI](https://img.shields.io/pypi/v/gradio)](https://pypi.org/project/gradio/) [![PyPI downloads](https://img.shields.io/pypi/dm/gradio)](https://pypi.org/project/gradio/) ![Python version](https://img.shields.io/badge/python-3.10+-important) [![Twitter follow](https://img.shields.io/twitter/follow/gradio?style=social&label=follow)](https://twitter.com/gradio) [Website](https://gradio.app) | [Documentation](https://gradio.app/docs/) | [Guides](https://gradio.app/guides/) | [Getting Started](https://gradio.app/getting_started/) | [Examples](demo/)
English | [中文](readme_files/zh-cn#readme)

Gradio: Build Machine Learning Web Apps — in Python

Gradio is an open-source Python package that allows you to quickly build a demo or web application for your machine learning model, API, or any arbitrary Python function. You can then share a link to your demo or web application in just a few seconds using Gradio's built-in sharing features. No JavaScript, CSS, or web hosting experience needed!

It just takes a few lines of Python to create your own demo, so let's get started 💫

Installation

Prerequisite: Gradio 5 requires Python 3.10 or higher

We recommend installing Gradio using pip, which is included by default in Python. Run this in your terminal or command prompt:

bash pip install --upgrade gradio

[!TIP] It is best to install Gradio in a virtual environment. Detailed installation instructions for all common operating systems are provided here.

Building Your First Demo

You can run Gradio in your favorite code editor, Jupyter notebook, Google Colab, or anywhere else you write Python. Let's write your first Gradio app:

```python import gradio as gr

def greet(name, intensity): return "Hello, " + name + "!" * int(intensity)

demo = gr.Interface( fn=greet, inputs=["text", "slider"], outputs=["text"], )

demo.launch() ```

[!TIP] We shorten the imported name from gradio to gr. This is a widely adopted convention for better readability of code.

Now, run your code. If you've written the Python code in a file named app.py, then you would run python app.py from the terminal.

The demo below will open in a browser on http://localhost:7860 if running from a file. If you are running within a notebook, the demo will appear embedded within the notebook.

`hello_world_4` demo

Type your name in the textbox on the left, drag the slider, and then press the Submit button. You should see a friendly greeting on the right.

[!TIP] When developing locally, you can run your Gradio app in hot reload mode, which automatically reloads the Gradio app whenever you make changes to the file. To do this, simply type in gradio before the name of the file instead of python. In the example above, you would type: gradio app.py in your terminal. Learn more in the Hot Reloading Guide.

Understanding the Interface Class

You'll notice that in order to make your first demo, you created an instance of the gr.Interface class. The Interface class is designed to create demos for machine learning models which accept one or more inputs, and return one or more outputs.

The Interface class has three core arguments:

  • fn: the function to wrap a user interface (UI) around
  • inputs: the Gradio component(s) to use for the input. The number of components should match the number of arguments in your function.
  • outputs: the Gradio component(s) to use for the output. The number of components should match the number of return values from your function.

The fn argument is very flexible -- you can pass any Python function that you want to wrap with a UI. In the example above, we saw a relatively simple function, but the function could be anything from a music generator to a tax calculator to the prediction function of a pretrained machine learning model.

The inputs and outputs arguments take one or more Gradio components. As we'll see, Gradio includes more than 30 built-in components (such as the gr.Textbox(), gr.Image(), and gr.HTML() components) that are designed for machine learning applications.

[!TIP] For the inputs and outputs arguments, you can pass in the name of these components as a string ("textbox") or an instance of the class (gr.Textbox()).

If your function accepts more than one argument, as is the case above, pass a list of input components to inputs, with each input component corresponding to one of the arguments of the function, in order. The same holds true if your function returns more than one value: simply pass in a list of components to outputs. This flexibility makes the Interface class a very powerful way to create demos.

We'll dive deeper into the gr.Interface on our series on building Interfaces.

Sharing Your Demo

What good is a beautiful demo if you can't share it? Gradio lets you easily share a machine learning demo without having to worry about the hassle of hosting on a web server. Simply set share=True in launch(), and a publicly accessible URL will be created for your demo. Let's revisit our example demo, but change the last line as follows:

```python import gradio as gr

def greet(name): return "Hello " + name + "!"

demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")

demo.launch(share=True) # Share your demo with just 1 extra parameter 🚀 ```

When you run this code, a public URL will be generated for your demo in a matter of seconds, something like:

👉   https://a23dsf231adb.gradio.live

Now, anyone around the world can try your Gradio demo from their browser, while the machine learning model and all computation continues to run locally on your computer.

To learn more about sharing your demo, read our dedicated guide on sharing your Gradio application.

An Overview of Gradio

So far, we've been discussing the Interface class, which is a high-level class that lets to build demos quickly with Gradio. But what else does Gradio include?

Custom Demos with gr.Blocks

Gradio offers a low-level approach for designing web apps with more customizable layouts and data flows with the gr.Blocks class. Blocks supports things like controlling where components appear on the page, handling multiple data flows and more complex interactions (e.g. outputs can serve as inputs to other functions), and updating properties/visibility of components based on user interaction — still all in Python.

You can build very custom and complex applications using gr.Blocks(). For example, the popular image generation Automatic1111 Web UI is built using Gradio Blocks. We dive deeper into the gr.Blocks on our series on building with Blocks.

Chatbots with gr.ChatInterface

Gradio includes another high-level class, gr.ChatInterface, which is specifically designed to create Chatbot UIs. Similar to Interface, you supply a function and Gradio creates a fully working Chatbot UI. If you're interested in creating a chatbot, you can jump straight to our dedicated guide on gr.ChatInterface.

The Gradio Python & JavaScript Ecosystem

That's the gist of the core gradio Python library, but Gradio is actually so much more! It's an entire ecosystem of Python and JavaScript libraries that let you build machine learning applications, or query them programmatically, in Python or JavaScript. Here are other related parts of the Gradio ecosystem:

  • Gradio Python Client (gradio_client): query any Gradio app programmatically in Python.
  • Gradio JavaScript Client (@gradio/client): query any Gradio app programmatically in JavaScript.
  • Gradio-Lite (@gradio/lite): write Gradio apps in Python that run entirely in the browser (no server needed!), thanks to Pyodide.
  • Hugging Face Spaces: the most popular place to host Gradio applications — for free!

What's Next?

Keep learning about Gradio sequentially using the Gradio Guides, which include explanations as well as example code and embedded interactive demos. Next up: let's dive deeper into the Interface class.

Or, if you already know the basics and are looking for something specific, you can search the more technical API documentation.

Questions?

If you'd like to report a bug or have a feature request, please create an issue on GitHub. For general questions about usage, we are available on our Discord server and happy to help.

If you like Gradio, please leave us a ⭐ on GitHub!

Open Source Stack

Gradio is built on top of many wonderful open-source libraries!

huggingface python fastapi encode svelte vite pnpm tailwind storybook chromatic

License

Gradio is licensed under the Apache License 2.0 found in the LICENSE file in the root directory of this repository.

Citation

Also check out the paper Gradio: Hassle-Free Sharing and Testing of ML Models in the Wild, ICML HILL 2019, and please cite it if you use Gradio in your work.

@article{abid2019gradio, title = {Gradio: Hassle-Free Sharing and Testing of ML Models in the Wild}, author = {Abid, Abubakar and Abdalla, Ali and Abid, Ali and Khan, Dawood and Alfozan, Abdulrahman and Zou, James}, journal = {arXiv preprint arXiv:1906.02569}, year = {2019}, }

Owner

  • Name: Víctor Belinchón
  • Login: kzon94
  • Kind: user
  • Location: Madrid

GitHub Events

Total
  • Create event: 195
Last Year
  • Create event: 195

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/actions/changes/action.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/github/actions/filter-paths main composite
  • gradio-app/github/actions/input-to-json main composite
  • gradio-app/github/actions/json-to-output main composite
.github/actions/install-all-deps/action.yml actions
  • FedericoCarboni/setup-ffmpeg 583042d32dd1cabb8bd09df03bde06080da5c87c composite
  • actions/cache v4 composite
  • actions/setup-python v5 composite
  • gradio-app/gradio/.github/actions/install-frontend-deps main composite
.github/actions/install-frontend-deps/action.yml actions
  • actions/cache v4 composite
  • actions/setup-node v4 composite
  • pnpm/action-setup fe02b34f77f8bc703788d5817da081398fad5dd2 composite
.github/workflows/comment-queue.yml actions
  • gradio-app/github/actions/comment-pr main composite
.github/workflows/delete-stale-spaces.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/generate-changeset.yml actions
  • actions/checkout v4 composite
  • gradio-app/github/actions/find-pr main composite
  • gradio-app/github/actions/generate-changeset main composite
.github/workflows/npm-previews.yml actions
  • actions/checkout v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-frontend-deps main composite
.github/workflows/previews-build.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/github/actions/copy-demos main composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/previews-deploy.yml actions
  • actions/download-artifact v4 composite
  • gradio-app/github/actions/json-to-output main composite
.github/workflows/publish.yml actions
  • actions/checkout v4 composite
  • changesets/action aba318e9165b45b7948c60273e0b72fce0a64eb9 composite
  • gradio-app/github/actions/publish-pypi main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/semgrep.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • docker://docker * composite
  • gradio-app/github/actions/commit-status main composite
  • gradio-app/github/actions/json-to-output main composite
.github/workflows/storybook-build.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/storybook-deploy.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • chromaui/action fdbe7756d4dbf493e2fbb822df73be7accd07e1c composite
  • gradio-app/github/actions/json-to-output main composite
  • gradio-app/github/actions/set-commit-status main composite
.github/workflows/test-functional-lite.yml actions
  • actions/checkout v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/test-functional.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/test-hygiene.yml actions
  • actions/checkout v4 composite
  • actionsdesk/lfs-warning 4b98a8a5e6c429c23c34eee02d71553bca216425 composite
.github/workflows/test-python.yml actions
  • actions/checkout v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/tests-js.yml actions
  • actions/checkout v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-frontend-deps main composite
.github/workflows/trigger-changeset.yml actions
.github/workflows/trigger-semgrep.yml actions
  • actions/checkout v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
.github/workflows/update-checks.yml actions
  • actions/download-artifact v4 composite
  • gradio-app/github/actions/json-to-output main composite
  • gradio-app/github/actions/set-commit-status main composite
.github/workflows/website-build.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/github/actions/json-to-output main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/website-deploy.yml actions
  • actions/download-artifact v4 composite
  • cloudflare/wrangler-action v3 composite
  • gradio-app/github/actions/json-to-output main composite
.github/workflows/website-docs-build.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/gradio/.github/actions/changes main composite
  • gradio-app/gradio/.github/actions/install-all-deps main composite
.github/workflows/website-docs-deploy.yml actions
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
  • gradio-app/github/actions/json-to-output main composite
client/js/package.json npm
  • @types/ws ^8.5.10 development
  • esbuild ^0.21.0 development
  • @types/eventsource ^1.1.15
  • bufferutil ^4.0.7
  • eventsource ^2.0.2
  • fetch-event-stream ^0.1.5
  • msw ^2.2.1
  • semiver ^1.1.0
  • textlinestream ^1.1.1
  • typescript ^5.0.0
  • ws ^8.13.0
client/python/gradio_client/package.json npm
.config/lite-builder/pyproject.toml pypi
client/python/pyproject.toml pypi
client/python/requirements.txt pypi
  • fsspec *
  • httpx >=0.24.1
  • huggingface_hub >=0.19.3
  • packaging *
  • typing_extensions *
  • websockets >=10.0,<15.0
client/python/test/requirements.txt pypi
  • gradio * test
  • pydub ==0.25.1 test
  • pyright ==1.1.372 test
  • pytest ==7.1.2 test
  • pytest-asyncio * test
  • ruff ==0.4.1 test
demo/agent_chatbot/requirements.txt pypi
  • transformers >=4.47.0
demo/animeganv2/requirements.txt pypi
  • Pillow *
  • cmake *
  • gdown *
  • numpy *
  • onnxruntime-gpu *
  • opencv-python-headless *
  • scipy *
  • torch *
  • torchvision *
demo/annotatedimage_component/requirements.txt pypi
  • Pillow *
  • numpy *
  • requests *
demo/asr/requirements.txt pypi
  • torch *
  • torchaudio *
  • transformers *
demo/bar_plot/requirements.txt pypi
  • pandas *
demo/bar_plot_demo/requirements.txt pypi
  • pandas *
demo/barplot_component/requirements.txt pypi
  • pandas *
demo/blocks_flag/requirements.txt pypi
  • numpy *
demo/blocks_flipper/requirements.txt pypi
  • numpy *
demo/blocks_kinematics/requirements.txt pypi
  • numpy *
  • pandas *
demo/blocks_multiple_event_triggers/requirements.txt pypi
  • plotly *
  • pypistats *
  • python-dateutil *
demo/blocks_speech_text_sentiment/requirements.txt pypi
  • torch *
  • transformers *
demo/bokeh_plot/requirements.txt pypi
  • bokeh >=3.0
  • xyzservices *
demo/chatbot_core_components/requirements.txt pypi
  • matplotlib *
  • numpy *
  • pandas *
  • plotly *
demo/chatbot_dialogpt/requirements.txt pypi
  • torch *
  • transformers *
demo/chatbot_retry_undo_like/requirements.txt pypi
  • huggingface_hub *
demo/chicago-bikeshare-dashboard/requirements.txt pypi
  • SQLAlchemy *
  • matplotlib *
  • pandas *
  • psycopg2 *
demo/clear_components/requirements.txt pypi
  • matplotlib *
  • numpy *
  • pandas *
demo/color_generator/requirements.txt pypi
  • numpy *
  • opencv-python *
demo/color_picker/requirements.txt pypi
  • Pillow *
demo/dashboard/requirements.txt pypi
  • pandas *
  • plotly *
demo/dataframe_colorful/requirements.txt pypi
  • pandas *
demo/dataframe_datatype/requirements.txt pypi
  • numpy *
  • pandas *
demo/dataset/requirements.txt pypi
  • numpy *
demo/depth_estimation/requirements.txt pypi
  • Pillow *
  • jinja2 *
  • numpy *
  • open3d *
  • torch *
  • transformers add_dpt_redesign
demo/diffusers_with_batching/requirements.txt pypi
  • diffusers *
  • torch *
  • transformers *
demo/english_translator/requirements.txt pypi
  • torch *
  • transformers *
demo/fake_diffusion/requirements.txt pypi
  • numpy *
demo/fake_diffusion_with_gif/requirements.txt pypi
  • Pillow *
  • numpy *
  • requests *
demo/fraud_detector/requirements.txt pypi
  • pandas *
demo/gallery_selections/requirements.txt pypi
  • numpy *
demo/generate_english_german/requirements.txt pypi
  • torch *
  • transformers *
demo/generate_tone/requirements.txt pypi
  • numpy *
demo/gif_maker/requirements.txt pypi
  • opencv-python *
demo/gradio_pdf_demo/requirements.txt pypi
  • gradio_pdf ==0.0.7
demo/image_classification/requirements.txt pypi
  • requests *
  • torch *
  • torchvision *
demo/image_classifier/requirements.txt pypi
  • numpy *
  • requests *
  • tensorflow *
demo/image_classifier_2/requirements.txt pypi
  • pillow *
  • requests *
  • torch *
  • torchvision *
demo/image_segmentation/requirements.txt pypi
  • numpy *
demo/image_selections/requirements.txt pypi
  • numpy *
demo/json_component/requirements.txt pypi
  • numpy *
demo/kitchen_sink/requirements.txt pypi
  • numpy *
demo/kitchen_sink_random/requirements.txt pypi
  • matplotlib *
  • pandas *
demo/line_plot/requirements.txt pypi
  • pandas *
  • vega_datasets *
demo/line_plot_demo/requirements.txt pypi
  • pandas *
demo/lineplot_component/requirements.txt pypi
  • vega_datasets *
demo/live_dashboard/requirements.txt pypi
  • numpy *
  • pandas *
  • plotly *
demo/llm_claude/requirements.txt pypi
  • openai >=1.0.0
demo/llm_hf_transformers/requirements.txt pypi
  • torch >=2.3.1
  • transformers >=4.46.0
demo/llm_hyperbolic/requirements.txt pypi
  • openai >=1.0.0
demo/llm_langchain/requirements.txt pypi
  • langchain *
  • langchain-openai *
demo/llm_llamaindex/requirements.txt pypi
  • llama-index *
  • openai *
demo/llm_openai/requirements.txt pypi
  • openai >=1.0.0
demo/llm_sambanova/requirements.txt pypi
  • openai >=1.0.0
demo/login_with_huggingface/requirements.txt pypi
  • huggingface_hub *
demo/loginbutton_component/requirements.txt pypi
  • gradio *
demo/magic_8_ball/requirements.txt pypi
  • accelerate *
  • huggingface_hub *
  • pydub *
  • spaces *
  • torch *
  • transformers *
demo/main_note/requirements.txt pypi
  • matplotlib *
  • numpy *
  • scipy *
demo/map_airbnb/requirements.txt pypi
  • datasets *
  • plotly *
demo/mini_leaderboard/requirements.txt pypi
  • pandas *
demo/musical_instrument_identification/requirements.txt pypi
  • gdown *
  • librosa ==0.9.2
  • torch ==1.12.0
  • torchaudio ==0.12.0
  • torchvision ==0.13.0
demo/native_plots/requirements.txt pypi
  • pandas *
  • vega_datasets *
demo/neon-tts-plugin-coqui/requirements.txt pypi
  • neon-tts-plugin-coqui ==0.4.1a9
demo/ner_pipeline/requirements.txt pypi
  • torch *
  • transformers *
demo/outbreak_forecast/requirements.txt pypi
  • altair *
  • bokeh *
  • matplotlib *
  • numpy *
  • plotly *
demo/plot_component/requirements.txt pypi
  • matplotlib *
  • numpy *
demo/plot_guide_datetimerange/requirements.txt pypi
  • gradio_datetimerange *
demo/plot_guide_line/requirements.txt pypi
  • numpy *
  • pandas *
demo/plot_guide_temporal/requirements.txt pypi
  • numpy *
  • pandas *