Skip to content

Commit e7b2be7

Browse files
committed
Added tiny cnn execution
1 parent 17b0334 commit e7b2be7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

app/mod_photos/controllers.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def timestamp():
2727
def execute_tiny_cnn(filepath):
2828
#TODO add code tiny cpp examplei
2929
# ~/caffenet/deploy.prototxt ~/caffenet/bvlc_alexnet.caffemodel ~/caffenet/imagenet_mean.binaryproto ~/caffenet/synset_words.txt ~/caffenet/cat.jpg
30-
output=check_output(["example_caffe_converter","deploy.prototxt bvlc_alexnet.caffemodel imagenet_mean.binaryproto synset_words.txt "+str(filepath)])
30+
app.logger.debug("filepath="+str(filepath))
31+
output=check_output(["example_caffe_converter","deploy.prototxt","bvlc_alexnet.caffemodel","imagenet_mean.binaryproto","synset_words.txt",str(filepath)])
3132
#output=check_output(["echo", "caca1:resultado1\ncaca2:resultado2\ncaca3:resultado3\ncaca4:resultado4\ncaca5:resultado5"])
3233
app.logger.debug("output="+str(output))
3334
values = output.split("\n")[:-1][-5:]
@@ -55,12 +56,15 @@ def post_photos():
5556
app.logger.debug("identifier="+identifier)
5657
filepath=os.path.join(app.config['UPLOAD_FOLDER'], f_name)
5758
#First result
58-
values = execute_tiny_cnn(filepath)
59-
result = '\n'.join(values)
6059

61-
data ={'uuid':identifier, 'filepath': filepath, 'analysed':True, 'info':str(values)}
62-
new_photo = Photo.create(**data)
6360
file.save(filepath)
61+
62+
values = execute_tiny_cnn(filepath)
63+
result = '\n'.join(values)
64+
65+
data_to_object ={'uuid':identifier, 'filepath': filepath, 'analysed':True, 'info':str(values)}
66+
new_photo = Photo.create(**data_to_object)
67+
6468
data = {'filename':f_name, 'info':str(values),'id': new_photo.id}
6569
#TODO refactor to set up necessary methods to create responses
6670
#TODO is it necessary to return 200 command

0 commit comments

Comments
 (0)