示例#1
0
def new_model(name, width, height, type):
    post('ml/model', None, {
        'name': name,
        'width': width,
        'height': height,
        'type': type
    }, opts)
示例#2
0
文件: steder.py 项目: smorgrav/stedr
def add_integration(stdr, name, type, params, opts: options.Options):
    if params is None:
        params = []
    paramsdict = {
        params[i].split("=")[0]: params[i].split("=")[1]
        for i in range(0, len(params))
    }
    print(paramsdict)
    post(f'stedr/{stdr}/integration', {}, {
        "name": name,
        "type": type,
        "params": paramsdict
    }, opts)
示例#3
0
文件: snap.py 项目: smorgrav/stedr
def image_reeval(stedr, imageid, imagelist, progress, opts):
    success = 0
    failures = 0

    if imageid is not None:
        try:
            post(f'snap/{stedr}/{imageid}/eval', None, None, opts)
        except:
            click.echo("Unable re-evaluate snap with id: " + imageid)

    else:
        if imagelist is None:
            click.echo("You must specify either snap id or a file")
            return False
        if not isfile(imagelist):
            click.echo(
                "file must be a regular file with ids separated by newline")
        if not progress:
            progress = imagelist + ".progress"
        with open(imagelist) as f:
            all_lines = [
                fileline.split(",")[0].strip() for fileline in f.readlines()
            ]
            if all_lines[0] == 'id':  # Remove header if this is a csv file
                all_lines.pop(0)
            with click.progressbar(all_lines,
                                   label='Reprocess images') as allIds:
                for imgid in allIds:
                    if not progress_already_contains_item(progress, imgid):
                        try:
                            post(f'snap/{stedr}/{imgid}/eval', None, None,
                                 opts)
                            update_progress_file(progress, imgid, True)
                            success += 1
                        except:
                            update_progress_file(progress, imgid, False)
                            failures += 1

    click.echo(f'Successfully re-evaluated {success} images')
    if failures > 0:
        click.echo(
            f'Failed re-evaluating {failures} images - see {progress} for details'
        )
示例#4
0
文件: snap.py 项目: smorgrav/stedr
def image_upload(stedr, path, reprocess, backfill, date, progress,
                 opts: options.Options):
    # Start populating request data
    # TODO proper options for backfill and reprocess
    data = {}
    params = {}
    if reprocess:
        params['reprocess'] = reprocess
    if backfill:
        params['backfill'] = backfill

    # Get all files to upload
    if isdir(path):
        if opts.verbose > 1:
            click.echo('Uploading images from %s' % path)
        onlyfiles = [f for f in listdir(path) if isfile(join(path, f))]
        with click.progressbar(onlyfiles,
                               label='Uploading images') as allfiles:
            for f in allfiles:
                if not progress_already_contains_item(progress, f):
                    try:
                        fullfile = join(path, f)
                        #populate_from_exif(fullfile, data)
                        adjustdate(data, date)
                        data['image'] = encode(fullfile)
                        post(f'snap/{stedr}', params, data, opts)
                        update_progress_file(progress, f, True)
                    except:
                        update_progress_file(progress, f, False)
    else:
        if opts.verbose > 1:
            click.echo('Uploading image %s' % path)
        if not progress_already_contains_item(progress, path):
            try:
                #populate_from_exif(path, data)
                adjustdate(data, date)
                data['image'] = encode(path)
                post(f'snap/{stedr}', params, data, opts)
                update_progress_file(progress, path, True)
            except Exception as e:
                click.echo('Error' % e)
                update_progress_file(progress, path, False)
示例#5
0
def train_model(modelid):
    post(f'ml/model/{modelid}/train', None, None, opts)
示例#6
0
def wordcount():
    post('dataflow/wordcount', None, {}, opts)
示例#7
0
def remakemonth(stedr, year, month, opts: options.Options):
    if month == 0:
        for m in range(1, 13):
            post(f'timelapse/{stedr}/remakemonth/{year}/{m}', None, {}, opts)
    else:
        post(f'timelapse/{stedr}/remakemonth/{year}/{month}', None, {}, opts)
示例#8
0
def remakeimage(stedr, year, opts: options.Options):
    post(f'timelapse/{stedr}/remakeimage/{year}', None, {}, opts)
示例#9
0
文件: steder.py 项目: smorgrav/stedr
def set_heartbeat(stdr, hours, type, id, opts: options.Options):
    post(f'stedr/{stdr}/heartbeat', {
        "hours": hours,
        "type": type,
        "id": id
    }, {}, opts)
示例#10
0
文件: steder.py 项目: smorgrav/stedr
def set_watermark(stedr, f, pos, mode, opts: options.Options):
    data = {'image': encode(f), 'mode': mode, 'position': pos}
    post(f'stedr/{stedr}/watermark', None, data, opts)
示例#11
0
文件: steder.py 项目: smorgrav/stedr
def run_cronfull(stdr, opts: options.Options):
    params = {}
    if stdr is not None:
        params["stedr"] = stdr

    post(f'cron/run', params, {}, opts)
示例#12
0
文件: steder.py 项目: smorgrav/stedr
def run_cronrules(stdr, opts: options.Options):
    post(f'cron/{stdr}/rules/run', {}, {}, opts)
示例#13
0
文件: steder.py 项目: smorgrav/stedr
def run_cronsource(stdr, count, backfill, opts: options.Options):
    post(f'cron/{stdr}/source/run', {
        "count": count,
        "backfill": backfill
    }, {}, opts)
示例#14
0
文件: snap.py 项目: smorgrav/stedr
def image_predict(stedr, snap, opts):
    post(f'snap/{stedr}/{snap}/ml', None, None, opts)
示例#15
0
def deploy_model(modelid):
    post(f'ml/model/{modelid}/deploy', None, None, opts)
示例#16
0
文件: steder.py 项目: smorgrav/stedr
def add_rule(stdr, opts: options.Options):
    post(f'stedr/{stdr}/rule', {}, {}, opts)
示例#17
0
def manual_model(modelid, projectid, model, version):
    post(f'ml/model/{modelid}/manual', {'projectid': projectid, 'model': model, 'version': version}, None, opts)
示例#18
0
文件: snap.py 项目: smorgrav/stedr
def image_upload_from_source(stedr, backfill, count, opts):
    params = {"count": count}
    if backfill:
        params["backfill"] = ''
    post(f'cron/{stedr}/source', params, {}, opts)