Skip to main content

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

  1. Import the tunnel lifespan function initializer in your FastAPI app:

    from gradio_fastapi import gradio_lifespan_init
    
  2. Set the lifespan of the App:

    1. If you do not already have a lifespan function defined:
      app = FastAPI(lifespan=gradio_lifespan_init())
      
    2. If you do
      app = FastAPI(lifespan=gradio_lifespan_init(my_lifespan))
      
  3. 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


Download files

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

Source Distribution

gradio_fastapi-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

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

Hashes for gradio_fastapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 31774426d4753658ba6d8c06608830e25d99a458185751de47519e58daa24df2
MD5 27066527e793f42c9f1a2938c257e01f
BLAKE2b-256 8fed7c4ce6f5574e5924f7cb62943c1c2bd99de4f2197eba024148a7bfbeb836

See more details on using hashes here.

Supported by

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