Easily Share and Demo Your FastAPI Apps using Gradio Public URL Tunneling
Project description
Gradio-FastAPI: Publicly Share and Demo Your FastAPI Apps Through Gradio Tunneling
This repository provides a simple and efficient way to tunnel any FastAPI application through a public Gradio URL. By leveraging this tool, developers can quickly demo and share their FastAPI applications with others without the need for complex server configurations or deployment processes. Ideal for quick prototyping, testing, and collaborative development, this solution ensures your FastAPI app is accessible from anywhere with minimal setup.
Features
- Seamless Integration: Easily connect your FastAPI app to a public Gradio URL.
- Quick Setup: Get your FastAPI app running publicly in just a few steps.
- Convenient Sharing: Share your app with collaborators via a simple URL.
- Efficient Prototyping: Perfect for quick demos, testing, and feedback collection.
Installation
pip install fastapi-gradio
Usage
-
Import the tunnel lifespan function initializer in your FastAPI app:
from gradio_fastapi import gradio_lifespan_init
-
Set the lifespan of the App:
- If you do not already have a lifespan function defined:
app = FastAPI(lifespan=gradio_lifespan_init())
- If you do
app = FastAPI(lifespan=gradio_lifespan_init(my_lifespan))
- If you do not already have a lifespan function defined:
-
Run your app and get the public Gradio URL for sharing logged using uvicorn:
fastapi dev main.py
Example
Check out example.py for a sample FastAPI application using this tunnel.
Contributions
Feel free to open issues or submit pull requests. Contributions are welcome!
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file gradio_fastapi-0.1.0.tar.gz
.
File metadata
- Download URL: gradio_fastapi-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31774426d4753658ba6d8c06608830e25d99a458185751de47519e58daa24df2 |
|
MD5 | 27066527e793f42c9f1a2938c257e01f |
|
BLAKE2b-256 | 8fed7c4ce6f5574e5924f7cb62943c1c2bd99de4f2197eba024148a7bfbeb836 |