コード例 #1
0
    def reload(self):
        self.tasks = None
        self.derived_input_schema = []
        self.derived_output_schema = {
            'from_name_to_name_type': set(),
            'labels': defaultdict(set)
        }

        self._init()

        self.label_config_full = config_comments_free(
            open(self.config['label_config']).read())
        self.label_config_line = config_line_stripped(self.label_config_full)

        if self.analytics is None:
            self.analytics = Analytics(
                self.label_config_line,
                self.config.get('collect_analytics', True), self.name)
        else:
            self.analytics.update_info(
                self.label_config_line,
                self.config.get('collect_analytics', True), self.name)

        # configure project
        self.project_obj = ProjectObj(label_config=self.label_config_line,
                                      label_config_full=self.label_config_full)

        # configure machine learning backend
        if self.ml_backend is None:
            ml_backend_params = self.config.get('ml_backend')
            if ml_backend_params:
                ml_backend = MLBackend.from_params(ml_backend_params)
                self.project_obj.connect(ml_backend)

        self.converter = Converter(self.label_config_full)
コード例 #2
0
ファイル: project.py プロジェクト: wwwK/label-studio
 def load_label_config(self):
     with open(self.label_config_path, encoding='utf8') as f:
         self.label_config_full = config_comments_free(f.read())
     self.label_config_line = config_line_stripped(self.label_config_full)
     self.parsed_label_config = parse_config(self.label_config_line)
     self.config_input_tags = self.get_config_input_tags(
         self.label_config_line)
コード例 #3
0
def reload_config(prompt_inputs=False, force=False):
    global c
    global label_config_line
    global analytics
    global ml_backend
    global project
    global config_path

    # Read config from config.json & input arguments
    c = json.load(open(config_path))
    c['port'] = input_args.port if input_args.port else c['port']
    c['label_config'] = input_args.label_config if input_args.label_config else c[
        'label_config']
    c['input_path'] = input_args.input_path if input_args.input_path else c[
        'input_path']
    c['output_dir'] = input_args.output_dir if input_args.output_dir else c[
        'output_dir']
    c['debug'] = input_args.debug if input_args.debug is not None else c[
        'debug']

    # If specified, prompt user in console about specific inputs
    if prompt_inputs:
        iprompt = LabelStudioConfigPrompt(c)
        c['input_data'] = iprompt.ask_input_path()
        c['output_dir'] = iprompt.ask_output_dir()
        c['label_config'] = iprompt.ask_label_config()

    # Initialize DBs
    db.re_init(c)

    label_config_full = config_comments_free(open(c['label_config']).read())
    label_config_line = config_line_stripped(label_config_full)
    if analytics is None:
        analytics = Analytics(label_config_line,
                              c.get('collect_analytics', True))
    else:
        analytics.update_info(label_config_line,
                              c.get('collect_analytics', True))
    # configure project
    if project is None or force:
        project = Project(label_config=label_config_line,
                          label_config_full=label_config_full)
    # configure machine learning backend
    if ml_backend is None or force:
        ml_backend_params = c.get('ml_backend')
        if ml_backend_params:
            ml_backend = MLBackend.from_params(ml_backend_params)
            project.connect(ml_backend)

    return True
コード例 #4
0
ファイル: project.py プロジェクト: rajeshnair/label-studio
 def load_label_config(self):
     self.label_config_full = config_comments_free(
         open(self.config["label_config"], encoding="utf8").read())
     self.label_config_line = config_line_stripped(self.label_config_full)
     self.parsed_label_config = parse_config(self.label_config_line)
     self.input_data_tags = self.get_input_data_tags(self.label_config_line)
コード例 #5
0
ファイル: project.py プロジェクト: tboesch/label-studio
 def load_label_config(self):
     self.label_config_full = config_comments_free(
         open(self.config['label_config']).read())
     self.label_config_line = config_line_stripped(self.label_config_full)
     self.input_data_tags = self.get_input_data_tags(self.label_config_line)