Viewing File: /home/ubuntu/.local/lib/python3.10/site-packages/gradio/wasm_utils.py

import sys

# See https://pyodide.org/en/stable/usage/faq.html#how-to-detect-that-code-is-run-with-pyodide
IS_WASM = sys.platform == "emscripten"


class WasmUnsupportedError(Exception):
    pass


app = None


# `register_app` and `get_registered_app` are used
# for the Wasm worker to get a reference to
# the Gradio's FastAPI app instance (`app`).
def register_app(_app):
    global app
    if app:
        app.blocks.close()
    app = _app


def get_registered_app():
    global app
    return app
Back to Directory File Manager