Ejemplo n.º 1
0
def hello():
    if request.method == 'GET':
        return render_template("index.html")
    if request.method == 'POST':
        if 'file' not in request.files:
            print("file not uploaded")
            return
        file = request.files['file']
        image = file.read()
        get_flower_name(image_bytes=image)
        return render_template('result.html', flower='lily')
Ejemplo n.º 2
0
def hello_world():
	if request.method == 'GET':
		return render_template('index.html', value='hi')
	if request.method == 'POST':
		print(request.files)
		if 'file' not in request.files:
			print('file not uploaded')
			return
		file = request.files['file']
		image = file.read()
		category, flower_name = get_flower_name(image_bytes=image)
		get_flower_name(image_bytes=image)
		tensor = get_tensor(image_bytes=image)
		print(get_tensor(image_bytes=image))
		return render_template('result.html', flower=flower_name, category=category)
Ejemplo n.º 3
0
def hello_world():
	if request.method=='GET':
		return render_template('index.html')
	if request.method=='POST':
		if 'file' not in request.files:
			print("file not uploaded,try again")
			return
		file=request.files['file']
		image=file.read()
		category,flower_name=get_flower_name(image_bytes=image)
		return render_template('result.html',flower=flower_name,category=category)
Ejemplo n.º 4
0
def hello_world():
    if request.method == 'GET':
        return render_template('index.html')
    if request.method == 'POST':
        try:
            file = request.files['file']
            image = file.read()
            flower_name = get_flower_name(image_bytes=image)
            return render_template('result.html', flower=flower_name)

        except:

            return render_template('index.html')
def upload_file():
    if request.method == 'GET':
        return render_template('upload_file.html')
    if request.method == 'POST':
        if "file" not in request.files:
            print("File not uploaded.")
            return
        file = request.files['file']
        image = file.read()
        tensor = get_tensor(image_bytes=image)
        category, flower = get_flower_name(image_bytes=image)
        print(get_tensor(image_bytes=image))
        return render_template('result_file.html', flower=flower)
Ejemplo n.º 6
0
def hello_world():
	if request.method == 'GET':
		return render_template('index1.html', value='hi')
	if request.method == 'POST':
		print(request.files)
		if 'file' not in request.files:
			print('file not uploaded')
			return
		file = request.files['file']
		image = file.read()
		flower_name= get_flower_name(image_bytes=image)
		get_flower_name(image_bytes=image)
		tensor = get_tensor(image_bytes=image)
		#print(get_tensor(image_bytes=image))
		#train_dir = 'dogImages/train'
		#path1=train_dir+'/'+imgclass
		#path2=os.listdir(path1)[0]
		#pathx=imgclass+'/'+path2
		#path3=path1+'/'+path2
		#yy='../'+path3
		#b = f'"{yy}"'
		#y= '<img src='+b+'>'
		return render_template('result.html', flower=flower_name)
Ejemplo n.º 7
0
def index():
    if request.method == 'GET':
        clean_image()
        return render_template('index.html')

    if request.method == 'POST':
        if 'file' not in request.files or request.files is None:
            print('File not uploaded')
            return 'Error'
        file = request.files['file']
        file.save('static/' + file.filename)
        # image = file.read()
        image = None
        category, flower_name = get_flower_name(image_bytes=image, file=file)
        return render_template('result.html',
                               flower=flower_name,
                               category=category,
                               file=file)
Ejemplo n.º 8
0
def hello_world():
	if request.method == 'GET':
		flower_name=" "
		return render_template('index.html', flower= flower_name)
	if request.method == 'POST':
		flower_name=" "
		if 'file' not in request.files:
			print("file not uploaded")
			return
		
		file = request.files['file']
		#print('file uploaded')
		image = file.read()
		flower_name, category = get_flower_name(image_bytes=image)
		
		#tensor = get_tensor(image_bytes=image)
		#print(tensor.shape)
	#predicted_flower = 'White Lily'
	return render_template('index.html', flower= flower_name) 
Ejemplo n.º 9
0
def hello_world():
    if request.method == 'GET':
        return render_template("index.html", value="hello jatt")

    if request.method == 'POST':
        if 'file' not in request.files:
            print("file not uploaded")
            win32api.MessageBox(0, 'Input Some image first', 'WARNING',
                                0x00001000)
            return render_template("index.html", value="hello jatt")

        file = request.files['file']

        ty = imghdr.what(file)
        if ((ty == "jpeg" or ty == "jpg" or ty == "JPG" or ty == "JPEG")):
            image = file.read()
            category, flower_name = get_flower_name(image_bytes=image)
            return render_template('result.html',
                                   flower=flower_name,
                                   category=category)
        else:
            win32api.MessageBox(0, 'Only accepts .jpg or .jpeg files',
                                'WARNING', 0x00001000)
            return render_template("index.html", value="hello jatt")