Skip to content

Commit

Permalink
running now on python3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
savinay committed Mar 21, 2018
1 parent eda5528 commit c93cc9e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from PIL import Image
import base64
import re
import cStringIO
from io import StringIO
from io import BytesIO
import random
import tensorflow as tf

Expand Down Expand Up @@ -62,15 +63,15 @@ def allowed_file(filename):

@application.route('/save', methods=['POST'])
def get_image():
# model = load_model('./model/model.h5')
model = load_model('./model/latest_model.h5')
# model = load_model('./model/latest_model_new.h5')
image_b64 = request.values['imageBase64']
clss = request.values['class']
random_number = random.randint(0, 100000)
file_name = clss + str(random_number)
image_data = re.sub('^data:image/.+;base64,', '', image_b64).decode('base64')
image_PIL = Image.open(cStringIO.StringIO(image_data))
image_data = re.sub('^data:image/.+;base64,', '', image_b64)
# .decode('base64')

image_PIL = Image.open(BytesIO(base64.b64decode(image_data)))
image_np = np.array(image_PIL)
# print image_np
im = image.imresize(image_np, (150,150))
Expand Down

0 comments on commit c93cc9e

Please sign in to comment.