Ejemplo n.º 1
0
def upload_page():
    form = UploadForm()
    if form.validate_on_submit():
        output = s3_upload(form.example)
        flash('{src} uploaded to S3 as {dst}'.format(
            src=form.example.data.filename, dst=output))
    return render_template('example.html', form=form)
Ejemplo n.º 2
0
def upload_page():
    form = UploadForm()

    if form.validate_on_submit():
        directory = form.in_directory.data
        over_write = form.over_write_existing.data
        output = s3_upload(form.file_value, directory_val=directory, force=over_write)
        flash(output)

    return render_template('file_form.html',form=form)
Ejemplo n.º 3
0
def ticket(number):
        coll = get_coll("topics")
        topic = coll.find_one({"number": number})
	form = UploadForm()

    	if form.validate_on_submit():
        	output = s3_upload(form.file, app.config)
                result = coll.update_one({"number": number},
                                               {"$pushAll":
                                               {"posts": [{"text":request.form["text"],
                                                           "file_id": output,
                                                            "file_name": form.file.data.filename,
                                                            "time": datetime.datetime.now()}]}})
                flash(u'пост залит.')
                return redirect(request.path)
        return render_template('topic.html', form=form, topic=topic)
Ejemplo n.º 4
0
def upload_page():

    labels = []

    current_photos = s3_get_bucket_contents()
    form = UploadForm()
    if form.validate_on_submit():
        if len(current_photos) > 0:
            for photo in current_photos:
                delete_photo(photo)
        output = s3_upload(form.example)
        # flash('{src} uploaded to S3 as {dst}'.format(src=form.example.data.filename, dst=output))
        flash('attempting to classify your image: {dst}'.format(dst=output))

        # download_photo(output)

        # path_to_photo_directory = './images/'
        labels = classify_photo_rekognition(output)

    return render_template('upload.html', form=form, labels=labels)
Ejemplo n.º 5
0
def upload_page():
    form = UploadForm()
    if request.method == 'POST' and form.validate():
        output = s3_upload(form.example)
        flash('{src} uploaded to S3 as {dst}'.format(src=form.example.data.filename, dst=output))
    return render_template('example.html',form=form)
Ejemplo n.º 6
0
def upload_page():
    form = UploadForm()
    if form.validate_on_submit():
        output = s3_upload(form.example)
        flash('{src} uploaded to S3 as {dst}'.format(src=form.example.data.filename, dst=output))
    return render_template('example.html', form=form)
Ejemplo n.º 7
0
def upload_file6():
    file = request.files['file']
    type = request.form['type']
    output = s3_upload(file, upload_dir=type)
    return output