Ejemplo n.º 1
0
def run_image_inference():
    file = request.files['image']
    file_path = os.path.join(application.config['UPLOAD_FOLDER'],
                             file.filename)
    file.save(file_path)

    channel_layout = "RGB"
    if "channel_layout" in request.form:
        channel_layout_ = request.form["channel_layout"]
        if channel_layout_ in ["RGB", "RGBA"]:
            channel_layout = channel_layout_

    run_profile = ""
    if "run_profile" in request.form:
        run_profile = request.form["run_profile"]

    image_file_path = os.path.join(application.config['UPLOAD_FOLDER'],
                                   file.filename)
    predict_result = python_predict_client.predict_image(
        image_file_path,
        channel_layout=channel_layout,
        run_profile=run_profile,
        port=args.port)

    return render_template('image_inference.html',
                           image_file_path=image_file_path,
                           predict_result=predict_result)
Ejemplo n.º 2
0
def run_image_inference():
    file = request.files['image']
    file_path = os.path.join(application.config['UPLOAD_FOLDER'],
                             file.filename)
    file.save(file_path)

    image_file_path = os.path.join(application.config['UPLOAD_FOLDER'],
                                   file.filename)
    predict_result = python_predict_client.predict_image(image_file_path)

    return render_template('image_inference.html',
                           image_file_path=image_file_path,
                           predict_result=predict_result)
Ejemplo n.º 3
0
def run_image_inference():
  file = request.files['image']
  file_path = os.path.join(application.config['UPLOAD_FOLDER'], file.filename)
  file.save(file_path)

  image_file_path = os.path.join(application.config['UPLOAD_FOLDER'],
                                 file.filename)
  predict_result = python_predict_client.predict_image(image_file_path)

  return render_template(
      'image_inference.html',
      image_file_path=image_file_path,
      predict_result=predict_result)