Ejemplo n.º 1
0
 def select_file(*args, x=field):
     filename = FileDialog.openDir(None,
                                   directory=None,
                                   caption="Open File")
     if len(filename):
         x.setText(filename)
     self.valueChanged.emit()
Ejemplo n.º 2
0
    def _add_model_action(self):
        """Method called when user clicks 'add models' button."""
        dir = FileDialog.openDir(None, dir=None, caption="")

        if dir:
            self._cfg_getter.dir_paths.append(dir)
            self._update_cfgs()
Ejemplo n.º 3
0
    def save(
        self, output_dir: Optional[str] = None, labels_filename: Optional[str] = None
    ):
        """Save scripts and configs to run pipeline."""
        if output_dir is None:
            models_dir = os.path.join(os.path.dirname(self.labels_filename), "/models")
            output_dir = FileDialog.openDir(
                None, directory=models_dir, caption="Select directory to save scripts"
            )

            if not output_dir:
                return

        pipeline_form_data = self.pipeline_form_widget.get_form_data()
        items_for_inference = self.get_items_for_inference(pipeline_form_data)
        config_info_list = self.get_every_head_config_data(pipeline_form_data)

        if labels_filename is None:
            labels_filename = self.labels_filename

        runners.write_pipeline_files(
            output_dir=output_dir,
            labels_filename=labels_filename,
            config_info_list=config_info_list,
            inference_params=pipeline_form_data,
            items_for_inference=items_for_inference,
        )