How to use the gradio.networking.set_disabled_in_config_file 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_networking.py View on Github external
def test_set_sample_data(self):
        test_array = ["test1", "test2", "test3"]
        temp_dir = tempfile.mkdtemp()
        inp = inputs.Sketchpad()
        out = outputs.Label()
        networking.build_template(temp_dir, inp, out)
        networking.set_sample_data_in_config_file(temp_dir, test_array)
        # We need to come up with a better way so that the config file isn't invalid json unless
        # the following parameters are set... (TODO: abidlabs)
        networking.set_always_flagged_in_config_file(temp_dir, False)
        networking.set_disabled_in_config_file(temp_dir, False)
        config_file = os.path.join(temp_dir, 'static/config.json')
        with open(config_file) as json_file:
            data = json.load(json_file)
            self.assertTrue(test_array == data["sample_inputs"])
github gradio-app / gradio-UI / gradio / interface.py View on Github external
def update_config_file(self, output_directory):
        networking.set_interface_types_in_config_file(
            output_directory,
            self.input_interface.__class__.__name__.lower(),
            self.output_interface.__class__.__name__.lower(),
        )

        if hasattr(self.input_interface, 'get_sample_inputs'):
            networking.set_sample_data_in_config_file(
                output_directory,
                self.input_interface.get_sample_inputs()
            )

        networking.set_always_flagged_in_config_file(output_directory, self.always_flag)
        networking.set_disabled_in_config_file(output_directory, self.interactivity_disabled)