Skip to content

Commit 43e18d4

Browse files
committed
wip #63
1 parent fec4600 commit 43e18d4

File tree

9 files changed

+68
-23
lines changed

9 files changed

+68
-23
lines changed

camera.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ def __init__(self):
8181
self._photos.append({'name': filename})
8282
self.save_photo_metadata()
8383

84+
self._cnn_classifiers = {}
8485
cnn_model = config.Config.get().get("cnn_default_model", "")
8586
if cnn_model != "":
86-
self._cnn_classifier = CNNManager.get_instance().load_model(cnn_model)
87+
self._cnn_classifiers[cnn_model] = CNNManager.get_instance().load_model(cnn_model)
88+
self._cnn_classifier_default = self._cnn_classifiers[cnn_model]
8789

8890
super(Camera, self).__init__()
8991

@@ -373,13 +375,25 @@ def find_code(self):
373375
self._image_lock.release()
374376
return img.grayscale().find_code()
375377

376-
def find_class(self):
378+
def cnn_classify(self, model_name=None):
379+
classifier = None
380+
if model_name:
381+
classifier = self._cnn_classifiers.get(model_name)
382+
if classifier is None:
383+
classifier = CNNManager.get_instance().load_model(model_name)
384+
self._cnn_classifiers[model_name] = classifier
385+
else:
386+
classifier = self._cnn_classifier_default
387+
377388
self._image_lock.acquire()
378389
img = self.get_image(0)
379390
self._image_lock.release()
380-
classes = self._cnn_classifier.classify_image(img.mat())
381-
s_classes = sorted(classes.items(), key=lambda x: x[1])
382-
return s_classes[-1][0]
391+
classes = classifier.classify_image(img.mat())
392+
s_classes = sorted(classes.items(), key=lambda x: x[1], reverse=True)
393+
return s_classes
394+
395+
def find_class(self):
396+
return self.cnn_classify()[0][0]
383397

384398
def sleep(self, elapse):
385399
logging.debug("sleep: " + str(elapse))

cnn_manager.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ def _save_model_meta(self):
4646

4747
def delete_model(self, model_name):
4848
if self._models.get(model_name):
49-
os.remove(MODEL_PATH + "/" + model_name + ".pb")
50-
os.remove(MODEL_PATH + "/" + model_name + ".txt")
49+
try:
50+
os.remove(MODEL_PATH + "/" + model_name + ".pb")
51+
os.remove(MODEL_PATH + "/" + model_name + ".txt")
52+
except:
53+
logging.warning("model files not found: " + model_name)
5154
del self._models[model_name]
5255
self._save_model_meta()
5356

@@ -63,7 +66,6 @@ def train_new_model(self,
6366
trainer = self.TrainThread(self, model_name, architecture, image_tags, photos_meta, training_steps, learning_rate)
6467
trainer.start()
6568
self._trainers[model_name] = trainer
66-
#trainer.join()
6769

6870
def save_model_status(self, model_name, architecture, status):
6971
model_info = architecture.split("_")
@@ -93,13 +95,14 @@ def __init__(self, manager, model_name, architecture, image_tags, photos_metadat
9395
self.photos_metadata = photos_metadata
9496
self.learning_rate = learning_rate
9597
self.training_steps = training_steps
96-
self.trainer = CNNTrainer(manager, architecture)
98+
self.trainer = None
9799

98100
def update_train_status(self, model_name, status):
99101
model = self.manager._models.get(model_name)
100102
model["status"] = status
101103

102104
def run(self):
105+
self.trainer = CNNTrainer(self.manager, self.architecture)
103106
self.manager.save_model_status(self.model_name, self.architecture, 0)
104107
image_dir = self.prepare_images()
105108
logging.info("retrain")

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def get_locale():
7272
@app.route("/")
7373
def handle_home():
7474
stream_port = cam.stream_port if cam else ""
75-
return render_template('main.html', host=request.host[:request.host.find(':')], stream_port=stream_port, locale = get_locale(), config=app.bot_config, program_level=app.bot_config.get("prog_level", "std"), cam=cam!=None)
75+
return render_template('main.html', host=request.host[:request.host.find(':')], stream_port=stream_port, locale = get_locale(), config=app.bot_config, program_level=app.bot_config.get("prog_level", "std"), cam=cam!=None, cnn_model_names=json.dumps([[name] for name in cnn.get_models().keys()]))
7676

7777
@app.route("/config", methods=["POST"])
7878
def handle_config():

photos/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"tag": "", "name": "DSC110.jpg"}, {"tag": "other", "name": "DSC19.jpg"}, {"tag": "other", "name": "DSC111.jpg"}, {"tag": "kiwi", "name": "DSC94.jpg"}, {"tag": "other", "name": "DSC113.jpg"}, {"tag": "other", "name": "DSC118.jpg"}, {"tag": "apple", "name": "DSC60.jpg"}, {"tag": "other", "name": "DSC112.jpg"}, {"tag": "apple", "name": "DSC38.jpg"}, {"tag": "kiwi", "name": "DSC73.jpg"}, {"tag": "apple", "name": "DSC49.jpg"}, {"tag": "other", "name": "DSC24.jpg"}, {"tag": "kiwi", "name": "DSC74.jpg"}, {"tag": "kiwi", "name": "DSC96.jpg"}, {"tag": "kiwi", "name": "DSC97.jpg"}, {"tag": "apple", "name": "DSC48.jpg"}, {"tag": "other", "name": "DSC121.jpg"}, {"tag": "other", "name": "DSC15.jpg"}, {"tag": "other", "name": "DSC3.jpg"}, {"tag": "other", "name": "DSC9.jpg"}, {"tag": "other", "name": "DSC115.jpg"}, {"tag": "apple", "name": "DSC30.jpg"}, {"tag": "other", "name": "DSC22.jpg"}, {"tag": "other", "name": "DSC103.jpg"}, {"tag": "kiwi", "name": "DSC86.jpg"}, {"tag": "apple", "name": "DSC35.jpg"}, {"tag": "apple", "name": "DSC34.jpg"}, {"tag": "other", "name": "DSC100.jpg"}, {"tag": "apple", "name": "DSC29.jpg"}, {"tag": "apple", "name": "DSC61.jpg"}, {"tag": "kiwi", "name": "DSC77.jpg"}, {"tag": "kiwi", "name": "DSC95.jpg"}, {"tag": "kiwi", "name": "DSC93.jpg"}, {"tag": "kiwi", "name": "DSC89.jpg"}, {"tag": "kiwi", "name": "DSC62.jpg"}, {"name": "DSC10.jpg"}, {"tag": "other", "name": "DSC108.jpg"}, {"tag": "kiwi", "name": "DSC80.jpg"}, {"tag": "apple", "name": "DSC65.jpg"}, {"tag": "other", "name": "DSC123.jpg"}, {"tag": "apple", "name": "DSC55.jpg"}, {"tag": "apple", "name": "DSC50.jpg"}, {"name": "DSC4.jpg"}, {"tag": "kiwi", "name": "DSC75.jpg"}, {"tag": "other", "name": "DSC8.jpg"}, {"tag": "kiwi", "name": "DSC85.jpg"}, {"tag": "other", "name": "DSC104.jpg"}, {"tag": "kiwi", "name": "DSC88.jpg"}, {"tag": "apple", "name": "DSC59.jpg"}, {"tag": "apple", "name": "DSC41.jpg"}, {"tag": "other", "name": "DSC13.jpg"}, {"tag": "apple", "name": "DSC40.jpg"}, {"tag": "apple", "name": "DSC37.jpg"}, {"tag": "kiwi", "name": "DSC87.jpg"}, {"tag": "other", "name": "DSC14.jpg"}, {"tag": "apple", "name": "DSC64.jpg"}, {"tag": "other", "name": "DSC12.jpg"}, {"tag": "apple", "name": "DSC57.jpg"}, {"tag": "kiwi", "name": "DSC83.jpg"}, {"tag": "kiwi", "name": "DSC70.jpg"}, {"name": "DSC21.jpg"}, {"name": "DSC98.jpg"}, {"name": "DSC23.jpg"}, {"name": "DSC120.jpg"}, {"name": "DSC99.jpg"}, {"tag": "apple", "name": "DSC46.jpg"}, {"name": "DSC107.jpg"}, {"tag": "apple", "name": "DSC66.jpg"}, {"tag": "apple", "name": "DSC31.jpg"}, {"tag": "", "name": "DSC36.jpg"}, {"tag": "apple", "name": "DSC47.jpg"}, {"name": "DSC11.jpg"}, {"tag": "kiwi", "name": "DSC76.jpg"}, {"tag": "kiwi", "name": "DSC82.jpg"}, {"name": "DSC106.jpg"}, {"name": "DSC56.jpg"}, {"name": "DSC67.jpg"}, {"name": "DSC42.jpg"}, {"name": "DSC45.jpg"}, {"name": "DSC54.jpg"}, {"name": "DSC68.jpg"}, {"tag": "other", "name": "DSC5.jpg"}, {"tag": "other", "name": "DSC25.jpg"}, {"name": "DSC44.jpg"}, {"tag": "kiwi", "name": "DSC81.jpg"}, {"tag": "apple", "name": "DSC27.jpg"}, {"tag": "other", "name": "DSC124.jpg"}, {"tag": "other", "name": "DSC114.jpg"}, {"name": "DSC69.jpg"}, {"tag": "kiwi", "name": "DSC72.jpg"}, {"tag": "other", "name": "DSC18.jpg"}, {"tag": "other", "name": "DSC20.jpg"}, {"tag": "apple", "name": "DSC63.jpg"}, {"tag": "apple", "name": "DSC52.jpg"}, {"name": "DSC7.jpg"}, {"tag": "kiwi", "name": "DSC84.jpg"}, {"tag": "apple", "name": "DSC53.jpg"}, {"name": "DSC102.jpg"}, {"tag": "kiwi", "name": "DSC90.jpg"}, {"tag": "other", "name": "DSC109.jpg"}, {"tag": "other", "name": "DSC119.jpg"}, {"name": "DSC6.jpg"}, {"tag": "apple", "name": "DSC33.jpg"}, {"tag": "apple", "name": "DSC32.jpg"}, {"tag": "kiwi", "name": "DSC71.jpg"}, {"tag": "other", "name": "DSC116.jpg"}, {"tag": "apple", "name": "DSC51.jpg"}, {"tag": "other", "name": "DSC101.jpg"}, {"tag": "kiwi", "name": "DSC79.jpg"}, {"tag": "other", "name": "DSC16.jpg"}, {"tag": "other", "name": "DSC28.jpg"}, {"tag": "apple", "name": "DSC26.jpg"}, {"tag": "kiwi", "name": "DSC91.jpg"}, {"tag": "apple", "name": "DSC43.jpg"}, {"tag": "other", "name": "DSC125.jpg"}, {"tag": "kiwi", "name": "DSC92.jpg"}, {"tag": "other", "name": "DSC117.jpg"}, {"tag": "apple", "name": "DSC39.jpg"}, {"tag": "other", "name": "DSC126.jpg"}, {"tag": "other", "name": "DSC17.jpg"}, {"tag": "kiwi", "name": "DSC78.jpg"}, {"tag": "other", "name": "DSC127.jpg"}, {"tag": "other", "name": "DSC122.jpg"}, {"tag": "apple", "name": "DSC58.jpg"}, {"tag": "tomato", "name": "DSC128.jpg"}, {"tag": "tomato", "name": "DSC129.jpg"}, {"tag": "tomato", "name": "DSC130.jpg"}, {"tag": "tomato", "name": "DSC131.jpg"}, {"tag": "tomato", "name": "DSC132.jpg"}, {"tag": "tomato", "name": "DSC133.jpg"}, {"tag": "tomato", "name": "DSC134.jpg"}, {"tag": "tomato", "name": "DSC135.jpg"}, {"tag": "tomato", "name": "DSC136.jpg"}, {"tag": "tomato", "name": "DSC137.jpg"}, {"tag": "", "name": "DSC138.jpg"}, {"tag": "", "name": "DSC139.jpg"}, {"tag": "tomato", "name": "DSC140.jpg"}, {"tag": "tomato", "name": "DSC141.jpg"}, {"tag": "tomato", "name": "DSC142.jpg"}, {"tag": "tomato", "name": "DSC143.jpg"}, {"tag": "tomato", "name": "DSC144.jpg"}, {"tag": "tomato", "name": "DSC145.jpg"}, {"tag": "tomato", "name": "DSC146.jpg"}, {"tag": "tomato", "name": "DSC147.jpg"}, {"name": "DSC148.jpg"}, {"tag": "tomato", "name": "DSC149.jpg"}, {"tag": "tomato", "name": "DSC150.jpg"}, {"tag": "tomato", "name": "DSC151.jpg"}, {"tag": "tomato", "name": "DSC152.jpg"}, {"tag": "tomato", "name": "DSC153.jpg"}, {"tag": "tomato", "name": "DSC154.jpg"}, {"name": "DSC155.jpg"}, {"tag": "tomato", "name": "DSC156.jpg"}, {"tag": "tomato", "name": "DSC157.jpg"}]
1+
[{"tag": "", "name": "DSC110.jpg"}, {"tag": "other", "name": "DSC19.jpg"}, {"tag": "other", "name": "DSC111.jpg"}, {"tag": "kiwi", "name": "DSC94.jpg"}, {"tag": "other", "name": "DSC113.jpg"}, {"tag": "other", "name": "DSC118.jpg"}, {"tag": "apple", "name": "DSC60.jpg"}, {"tag": "other", "name": "DSC112.jpg"}, {"tag": "apple", "name": "DSC38.jpg"}, {"tag": "kiwi", "name": "DSC73.jpg"}, {"tag": "apple", "name": "DSC49.jpg"}, {"tag": "other", "name": "DSC24.jpg"}, {"tag": "kiwi", "name": "DSC74.jpg"}, {"tag": "kiwi", "name": "DSC96.jpg"}, {"tag": "kiwi", "name": "DSC97.jpg"}, {"tag": "apple", "name": "DSC48.jpg"}, {"tag": "other", "name": "DSC121.jpg"}, {"tag": "other", "name": "DSC15.jpg"}, {"tag": "other", "name": "DSC3.jpg"}, {"tag": "other", "name": "DSC9.jpg"}, {"tag": "other", "name": "DSC115.jpg"}, {"tag": "apple", "name": "DSC30.jpg"}, {"tag": "other", "name": "DSC22.jpg"}, {"tag": "other", "name": "DSC103.jpg"}, {"tag": "kiwi", "name": "DSC86.jpg"}, {"tag": "apple", "name": "DSC35.jpg"}, {"tag": "apple", "name": "DSC34.jpg"}, {"tag": "other", "name": "DSC100.jpg"}, {"tag": "apple", "name": "DSC29.jpg"}, {"tag": "apple", "name": "DSC61.jpg"}, {"tag": "kiwi", "name": "DSC77.jpg"}, {"tag": "kiwi", "name": "DSC95.jpg"}, {"tag": "kiwi", "name": "DSC93.jpg"}, {"tag": "kiwi", "name": "DSC89.jpg"}, {"tag": "kiwi", "name": "DSC62.jpg"}, {"name": "DSC10.jpg"}, {"tag": "other", "name": "DSC108.jpg"}, {"tag": "kiwi", "name": "DSC80.jpg"}, {"tag": "apple", "name": "DSC65.jpg"}, {"tag": "other", "name": "DSC123.jpg"}, {"tag": "apple", "name": "DSC55.jpg"}, {"tag": "apple", "name": "DSC50.jpg"}, {"name": "DSC4.jpg"}, {"tag": "kiwi", "name": "DSC75.jpg"}, {"tag": "other", "name": "DSC8.jpg"}, {"tag": "kiwi", "name": "DSC85.jpg"}, {"tag": "other", "name": "DSC104.jpg"}, {"tag": "kiwi", "name": "DSC88.jpg"}, {"tag": "apple", "name": "DSC59.jpg"}, {"tag": "apple", "name": "DSC41.jpg"}, {"tag": "other", "name": "DSC13.jpg"}, {"tag": "apple", "name": "DSC40.jpg"}, {"tag": "apple", "name": "DSC37.jpg"}, {"tag": "kiwi", "name": "DSC87.jpg"}, {"tag": "other", "name": "DSC14.jpg"}, {"tag": "apple", "name": "DSC64.jpg"}, {"tag": "other", "name": "DSC12.jpg"}, {"tag": "apple", "name": "DSC57.jpg"}, {"tag": "kiwi", "name": "DSC83.jpg"}, {"tag": "kiwi", "name": "DSC70.jpg"}, {"name": "DSC21.jpg"}, {"name": "DSC98.jpg"}, {"name": "DSC23.jpg"}, {"name": "DSC120.jpg"}, {"name": "DSC99.jpg"}, {"tag": "apple", "name": "DSC46.jpg"}, {"name": "DSC107.jpg"}, {"tag": "apple", "name": "DSC66.jpg"}, {"tag": "apple", "name": "DSC31.jpg"}, {"tag": "", "name": "DSC36.jpg"}, {"tag": "apple", "name": "DSC47.jpg"}, {"name": "DSC11.jpg"}, {"tag": "kiwi", "name": "DSC76.jpg"}, {"tag": "kiwi", "name": "DSC82.jpg"}, {"name": "DSC106.jpg"}, {"name": "DSC56.jpg"}, {"name": "DSC67.jpg"}, {"name": "DSC42.jpg"}, {"name": "DSC45.jpg"}, {"name": "DSC54.jpg"}, {"name": "DSC68.jpg"}, {"tag": "other", "name": "DSC5.jpg"}, {"tag": "other", "name": "DSC25.jpg"}, {"name": "DSC44.jpg"}, {"tag": "kiwi", "name": "DSC81.jpg"}, {"tag": "apple", "name": "DSC27.jpg"}, {"tag": "other", "name": "DSC124.jpg"}, {"tag": "other", "name": "DSC114.jpg"}, {"name": "DSC69.jpg"}, {"tag": "kiwi", "name": "DSC72.jpg"}, {"tag": "other", "name": "DSC18.jpg"}, {"tag": "other", "name": "DSC20.jpg"}, {"tag": "apple", "name": "DSC63.jpg"}, {"tag": "apple", "name": "DSC52.jpg"}, {"name": "DSC7.jpg"}, {"tag": "kiwi", "name": "DSC84.jpg"}, {"tag": "apple", "name": "DSC53.jpg"}, {"name": "DSC102.jpg"}, {"tag": "kiwi", "name": "DSC90.jpg"}, {"tag": "other", "name": "DSC109.jpg"}, {"tag": "other", "name": "DSC119.jpg"}, {"name": "DSC6.jpg"}, {"tag": "apple", "name": "DSC33.jpg"}, {"tag": "apple", "name": "DSC32.jpg"}, {"tag": "kiwi", "name": "DSC71.jpg"}, {"tag": "other", "name": "DSC116.jpg"}, {"tag": "apple", "name": "DSC51.jpg"}, {"tag": "other", "name": "DSC101.jpg"}, {"tag": "kiwi", "name": "DSC79.jpg"}, {"tag": "other", "name": "DSC16.jpg"}, {"tag": "other", "name": "DSC28.jpg"}, {"tag": "apple", "name": "DSC26.jpg"}, {"tag": "kiwi", "name": "DSC91.jpg"}, {"tag": "apple", "name": "DSC43.jpg"}, {"tag": "other", "name": "DSC125.jpg"}, {"tag": "kiwi", "name": "DSC92.jpg"}, {"tag": "other", "name": "DSC117.jpg"}, {"tag": "apple", "name": "DSC39.jpg"}, {"tag": "other", "name": "DSC126.jpg"}, {"tag": "other", "name": "DSC17.jpg"}, {"tag": "kiwi", "name": "DSC78.jpg"}, {"tag": "other", "name": "DSC127.jpg"}, {"tag": "other", "name": "DSC122.jpg"}, {"tag": "apple", "name": "DSC58.jpg"}, {"tag": "tomato", "name": "DSC128.jpg"}, {"tag": "tomato", "name": "DSC129.jpg"}, {"tag": "tomato", "name": "DSC130.jpg"}, {"tag": "tomato", "name": "DSC131.jpg"}, {"tag": "tomato", "name": "DSC132.jpg"}, {"tag": "tomato", "name": "DSC133.jpg"}, {"tag": "tomato", "name": "DSC134.jpg"}, {"tag": "tomato", "name": "DSC135.jpg"}, {"tag": "tomato", "name": "DSC136.jpg"}, {"tag": "tomato", "name": "DSC137.jpg"}, {"tag": "", "name": "DSC138.jpg"}, {"tag": "", "name": "DSC139.jpg"}, {"tag": "tomato", "name": "DSC140.jpg"}, {"tag": "tomato", "name": "DSC141.jpg"}, {"tag": "tomato", "name": "DSC142.jpg"}, {"tag": "tomato", "name": "DSC143.jpg"}, {"tag": "tomato", "name": "DSC144.jpg"}, {"tag": "tomato", "name": "DSC145.jpg"}, {"tag": "tomato", "name": "DSC146.jpg"}, {"tag": "tomato", "name": "DSC147.jpg"}, {"name": "DSC148.jpg"}, {"tag": "tomato", "name": "DSC149.jpg"}, {"tag": "tomato", "name": "DSC150.jpg"}, {"tag": "tomato", "name": "DSC151.jpg"}, {"tag": "tomato", "name": "DSC152.jpg"}, {"tag": "tomato", "name": "DSC153.jpg"}, {"tag": "tomato", "name": "DSC154.jpg"}, {"tag": "tomato", "name": "DSC156.jpg"}, {"tag": "tomato", "name": "DSC157.jpg"}]

static/js/blockly/blocks.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,29 @@ Blockly.Python['coderbot_adv_find_class'] = function(block) {
714714
return [name, Blockly.Python.ORDER_ATOMIC];
715715
};
716716

717+
Blockly.Blocks['coderbot_adv_cnn_classify'] = {
718+
/**
719+
* Block for find_class function.
720+
* @this Blockly.Block
721+
*/
722+
init: function() {
723+
this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);
724+
this.setColour(250);
725+
this.appendDummyInput()
726+
.appendField(Blockly.Msg.CODERBOT_SENSOR_FINDCLASS)
727+
.appendField(new Blockly.FieldDropdown(CODERBOT_CNN_MODEL_LIST), 'MODEL');
728+
this.setInputsInline(true);
729+
this.setOutput(true, ['Array']);
730+
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
731+
}
732+
};
733+
734+
Blockly.Python['coderbot_adv_cnn_classify'] = function(block) {
735+
var model = block.getFieldValue('MODEL');
736+
var class_scores = 'get_cam().cnn_classify("'+ model +'")';
737+
return [class_scores, Blockly.Python.ORDER_ATOMIC];
738+
};
739+
717740
Blockly.Blocks['coderbot_audio_record'] = {
718741
/**
719742
* Block for findLogo function.

static/js/control.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ $(document).on( "pagecreate", '#page-control', function( event ) {
9898
canvas.getContext('2d').drawImage(img.get(0), 0, 0, img.width(), img.height());
9999
var pixelData = canvas.getContext('2d').getImageData(x, y, 1, 1).data;
100100
var colorHex = "#" + paddedHexString(pixelData[0]) + paddedHexString(pixelData[1]) + paddedHexString(pixelData[2]);
101-
alert("Color at point: " + colorHex);
101+
alert(BotMessages.ColorAtPoint + colorHex);
102102
});
103103
$( ".photopopup" ).on({
104104
popupbeforeposition: function() {
@@ -179,7 +179,7 @@ $(document).on( "pagecreate", '#page-preferences', function( event ) {
179179
image_tags: form.find("#i_cnn_image_tags").val().split(",")};
180180
console.log(data);
181181
$.post(url='/cnnmodels', data=JSON.stringify(data), success=function(data) {
182-
alert("training...");
182+
alert(BotMessages.ModelTraining);
183183
}, dataType='json');
184184
return false;
185185
});
@@ -260,7 +260,7 @@ $('select.s_media_tag').change(function (e) {
260260
while(true) {
261261
tag_name = prompt("Enter a new tag:", "");
262262
if(tags.indexOf(tag_name)>=0) {
263-
alert("Tag already exists");
263+
alert(BotMessages.TagAlreadyExists);
264264
} else {
265265
$('<option value="' + tag_name + '">' + tag_name +'</option>').insertBefore('option.o_new');
266266
select.find('option').removeAttr('selected');
@@ -286,10 +286,10 @@ $(document).on( "click", '.b_photo_delete', function( event ) {
286286
var li = $(this).parents('li');
287287
var src = "/photos/" + li.find('img').attr('data-src');
288288
if(confirm(BotMessages.DeletePhotoConfirm + src + " ?")) {
289-
$.ajax(url=src, type="DELETE", success=function(data){
289+
$.ajax({url:src, method:"DELETE", success:function(data){
290290
li.remove();
291291
ul.listview('refresh');
292-
});
292+
}});
293293
}
294294
event.preventDefault();
295295
});

templates/blocks_adv.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
</block>
262262
<block type="coderbot_adv_findCode"></block>
263263
<block type="coderbot_adv_find_class"></block>
264+
<block type="coderbot_adv_cnn_classify"></block>
264265
<block type="coderbot_sonar_get_distance"></block>
265266
</category>{%endif%}
266267
<category name="{% trans %}Sound{% endtrans %}" colour="220">

0 commit comments

Comments
 (0)