Skip to main content

Jupyter magic commands for configuring Gradio apps on nanoHUB

Project description

nanohub-gradio

Documentation Status

Tools for running Gradio applications on nanoHUB.

Documentation

Full documentation is available at https://nanohub-gradio.readthedocs.io

Installation

pip install nanohub-gradio

Features

  • Jupyter Magic Command (%set_gradio_env): Configure environment variables for Gradio apps directly in Jupyter notebooks
  • Command-line Tool (start_gradio): Launch Gradio applications with automatic proxy configuration

Quick Start

Jupyter Notebook

%load_ext nanohubgradio
%set_gradio_env

import os
import gradio as gr

def greet(name):
    return f"Hello {name}!"

with gr.Blocks() as app:
    gr.Markdown("# Gradio App on nanoHUB")
    with gr.Row():
        text_input = gr.Textbox(label="Your Name")
        output = gr.Textbox(label="Greeting")
    text_input.change(greet, inputs=[text_input], outputs=[output])

if __name__ == "__main__":
    root_path = os.getenv("GRADIO_ROOT_PATH", "")
    app.launch(
        server_name="0.0.0.0",
        server_port=8001,
        root_path=root_path if root_path else None,
        share=False
    )

Command Line

start_gradio --app myapp.py

Environment Variables

The magic command sets the following environment variables:

  • GRADIO_ROOT_PATH - The proxy path prefix for Gradio
  • GRADIO_HOST - The bind host for Gradio
  • GRADIO_PORT - The port for Gradio

Requirements

  • Python >= 3.8
  • IPython >= 7.0
  • Gradio >= 4.0
  • Must be running on a nanoHUB environment with SESSION and SESSIONDIR environment variables set

License

MIT License - Copyright 2026 HUBzero Foundation, LLC.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanohub_gradio-0.1.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanohub_gradio-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file nanohub_gradio-0.1.0.tar.gz.

File metadata

  • Download URL: nanohub_gradio-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for nanohub_gradio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6826266f345e221b0b234ecd6e06982b4e1f0b5b9740861defab4bc9d2b420fd
MD5 afa8275312f21ba1c279a58e991737f1
BLAKE2b-256 104079fcf76c31771a1250d30605fdbaa0cc50d9cc469982c7a4bc8296a0d3b0

See more details on using hashes here.

File details

Details for the file nanohub_gradio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nanohub_gradio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for nanohub_gradio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdccede02951b3f4b7fcd9e08d426fd979d9ab348cde4ddbe7e4242339baf80b
MD5 d1c183e9681551520a90213ed35e3e60
BLAKE2b-256 ec2c58f2a603eee8d114a91225aa67b4e8191cd445db82510bcc7440de5c6568

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page