added disabled, always_flagged in config

This commit is contained in:
Abubakar Abid 2019-07-26 00:23:53 -07:00
parent 5159d31898
commit a3b05b25a2
5 changed files with 19 additions and 2 deletions

View File

@ -47,7 +47,8 @@ class Interface:
postprocessing_fns=None,
verbose=True,
saliency=None,
always_flag=False
always_flag=False,
interactivity_disabled=False,
):
"""
:param inputs: a string or `AbstractInput` representing the input interface.
@ -101,6 +102,7 @@ class Interface:
self.hash = random.getrandbits(32)
self.saliency = saliency
self.always_flag = always_flag
self.interactivity_disabled = interactivity_disabled
@staticmethod
def _infer_model_type(model):
@ -145,6 +147,9 @@ class Interface:
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)
def predict(self, preprocessed_input):
"""
Method that calls the relevant method of the model object to make a prediction.

View File

@ -132,7 +132,17 @@ def set_disabled_in_config_file(temp_dir, disabled):
render_template_with_tags(
config_file,
{
"disabled": disabled
"disabled": json.dumps(disabled)
},
)
def set_always_flagged_in_config_file(temp_dir, always_flagged):
config_file = os.path.join(temp_dir, CONFIG_FILE)
render_template_with_tags(
config_file,
{
"always_flagged": json.dumps(always_flagged)
},
)

View File

@ -2,5 +2,7 @@
"input_interface_type": "{{input_interface_type}}",
"output_interface_type": "{{output_interface_type}}",
"share_url": "{{share_url}}",
"disabled": "{{disabled}}",
"always_flagged": "{{always_flagged}}",
"sample_inputs": {{sample_inputs}}
}