コード例 #1
0
ファイル: facets.py プロジェクト: prise6/smart-iss-posts
def main():

    ## db manager
    db_manager = Tools.create_db_manager(CONFIG)

    ## request data
    df = request_data(CONFIG, db_manager)

    ## create sprite
    sprite = create_sprite(CONFIG, df)

    ## save sprite
    sprite.save(
        os.path.join(
            CONFIG.get('directory')['reports'], 'figures', 'sprite_altas.png'),
        "PNG")

    ## generate facets
    html_facets = generate_facets(CONFIG, df)
    with open(os.path.join(CONFIG.get('directory')['reports'], 'facets.html'),
              'w') as f:
        f.write(html_facets)

    ## generate facets-dive
    html_facets_dive = generate_facets_dive(CONFIG, df,
                                            './figures/sprite_altas.png')
    with open(
            os.path.join(
                CONFIG.get('directory')['reports'], 'facets-dive.html'),
            'w') as f:
        f.write(html_facets_dive)
コード例 #2
0
def main(action = 'populate_embedding'):

    db_manager = Tools.create_db_manager(CONFIG)

    if action == 'population_locations':
        populate_locations(CONFIG, db_manager)
    elif action == 'populate_embedding':
        db_manager.create_pictures_embedding_table(False)
        to_load = [
            {'clustering_type': 'n2d', 'clustering_version': 1, 'clustering_model_type': 'simple_conv', 'clustering_model_name': 'model_colab', 'drop': False},
            {'clustering_type': 'n2d', 'clustering_version': 2, 'clustering_model_type': 'simple_conv', 'clustering_model_name': 'model_colab', 'drop': False},
            {'clustering_type': 'n2d', 'clustering_version': 3, 'clustering_model_type': 'simple_conv', 'clustering_model_name': 'model_colab', 'drop': False},
            ]
        for kwargs in to_load:
            try:
                populate_embedding(CONFIG, db_manager, **kwargs)
            except Exception as err:
                print(err)
                pass
            
    else:
        pass
コード例 #3
0
ファイル: posters.py プロジェクト: prise6/smart-iss-posts
def main(config_id, generate, poster_id):

    N_GENERATE = generate
    POSTER_ID = poster_id

    db_manager = Tools.create_db_manager(CONFIG)

    ## creation de la base
    db_manager.create_posters_table()

    ##
    poster_config = POSTERS_CONFIG[config_id]

    ##
    pictures_df = get_pictures_df(CONFIG, db_manager, poster_config)

    ##
    poster = create_empty_poster(CONFIG, poster_config)

    ##
    poster = create_poster_template_picture(CONFIG, poster_config, poster)

    ##
    write_poster_picture(CONFIG, poster_config, poster, poster_id="template")

    for i in range(N_GENERATE):
        print("%s / %s" % (i + 1, N_GENERATE))
        ##
        poster, p_pos = create_poster_picture(CONFIG, poster_config, poster,
                                              pictures_df)

        ##
        poster_id = save_poster_picture(CONFIG, poster_config, p_pos,
                                        db_manager, POSTER_ID)

        ##
        write_poster_picture(CONFIG, poster_config, poster, poster_id)