semvec/pypi-packages huggingface dataset:
nanohub-gradio 0.1.0
Jupyter magic commands for configuring Gradio apps on nanoHUB
License: MIT
Requires Python: >=3.8
Keywords: jupyter, gradio, nanohub, magic

# nanohub-gradio

[![Documentation Status](https://readthedocs.org/projects/nanohub-gradio/badge/?version=latest)](https://nanohub-gradio.readthedocs.io/en/latest/?badge=latest)

Tools for running Gradio applications on nanoHUB.

## Documentation

Full documentation is available at [https://nanohub-gradio.readthedocs.io](https://nanohub-gradio.readthedocs.io)

## Installation

```bash
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

```python
%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

```bash
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.