How to use the gradio.inputs.BASE_INPUT_INTERFACE_JS_PATH.format function in gradio

To help you get started, we’ve selected a few gradio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gradio-app / gradio-UI / test / test_inputs.py View on Github external
def test_path_exists(self):
        inp = inputs.Sketchpad()
        path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
        self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
github gradio-app / gradio-UI / test / test_inputs.py View on Github external
def test_path_exists(self):
        inp = inputs.ImageUpload()
        path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
        self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
github gradio-app / gradio-UI / gradio / networking.py View on Github external
def build_template(temp_dir, input_interface, output_interface):
    """
    Create HTML file with supporting JS and CSS files in a given directory.
    :param temp_dir: string with path to temp directory in which the html file should be built
    """
    dir_util.copy_tree(STATIC_TEMPLATE_LIB, temp_dir)
    dir_util.copy_tree(STATIC_PATH_LIB, os.path.join(temp_dir, STATIC_PATH_TEMP))

    # Move association file to root of temporary directory.
    copyfile(os.path.join(temp_dir, ASSOCIATION_PATH_IN_STATIC),
             os.path.join(temp_dir, ASSOCIATION_PATH_IN_ROOT))

    render_template_with_tags(
        os.path.join(
            temp_dir,
            inputs.BASE_INPUT_INTERFACE_JS_PATH.format(input_interface.get_name()),
        ),
        input_interface.get_js_context(),
    )
    render_template_with_tags(
        os.path.join(
            temp_dir,
            outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(output_interface.get_name()),
        ),
        output_interface.get_js_context(),
    )
github gradio-app / gradio-UI / build / lib / gradio / networking.py View on Github external
def build_template(temp_dir, input_interface, output_interface):
    """
    Create HTML file with supporting JS and CSS files in a given directory.
    :param temp_dir: string with path to temp directory in which the html file should be built
    """
    dir_util.copy_tree(STATIC_TEMPLATE_LIB, temp_dir)
    dir_util.copy_tree(STATIC_PATH_LIB, os.path.join(temp_dir, STATIC_PATH_TEMP))

    # Move association file to root of temporary directory.
    copyfile(os.path.join(temp_dir, ASSOCIATION_PATH_IN_STATIC),
             os.path.join(temp_dir, ASSOCIATION_PATH_IN_ROOT))

    render_template_with_tags(
        os.path.join(
            temp_dir,
            inputs.BASE_INPUT_INTERFACE_JS_PATH.format(input_interface.get_name()),
        ),
        input_interface.get_js_context(),
    )
    render_template_with_tags(
        os.path.join(
            temp_dir,
            outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(output_interface.get_name()),
        ),
        output_interface.get_js_context(),
    )