Ejemplo n.º 1
0
def predict_url():
    url_link = request.args['url_link']
    url_image = requests.get(url_link)
    image_bytes = url_image.content
    class_id, class_name = get_prediction(image_bytes=image_bytes)
    class_name = format_class_name(class_name)
    return render_template('result.html', class_name=class_name)
Ejemplo n.º 2
0
def predictResNet50():
    if request.method == 'POST':
        file_path = get_file_path_and_save(request)
        im = Image.open(file_path)
        pred_class, class_name = get_prediction(image_bytes=im)
        result = format_class_name(class_name)

        return result
    return None
Ejemplo n.º 3
0
def upload_file():
    if request.method == 'POST':
        if 'file' not in request.files:
            return redirect(request.url)
        file = request.files.get('file')
        if not file:
            return
        img_bytes = file.read()
        class_name = get_prediction(image_bytes=img_bytes)
        class_name = format_class_name(class_name)
        return render_template('result.html', class_name=class_name)
    return render_template('index.html')
Ejemplo n.º 4
0
def upload_file():
    if request.method == 'POST':
        text = request.form.get('textbox')
        print('text is :', text)
        # if 'file' not in request.files:
        # return redirect(request.url)
        # file = request.files.get('file')
        # if not file:
        #     return
        #img_bytes = file.read()
        img_bytes = text
        #        class_id, class_name = get_prediction(image_bytes=img_bytes)
        reply = get_prediction(image_bytes=img_bytes)
        class_name = format_class_name(reply)
        return render_template('result.html', class_name=class_name)
        #  class_name=class_name)
    return render_template('index.html')