Update app.py
Browse files
app.py
CHANGED
|
@@ -102,10 +102,12 @@ def next():
|
|
| 102 |
app.config["LABELS"] = []
|
| 103 |
return redirect(url_for('tagger'))
|
| 104 |
|
|
|
|
| 105 |
@app.route("/final")
|
| 106 |
def final():
|
| 107 |
return render_template('final.html')
|
| 108 |
|
|
|
|
| 109 |
@app.route('/add/<id>')
|
| 110 |
def add(id):
|
| 111 |
xMin = request.args.get("xMin")
|
|
@@ -115,6 +117,7 @@ def add(id):
|
|
| 115 |
app.config["LABELS"].append({"id":id, "name":"", "xMin":xMin, "xMax":xMax, "yMin":yMin, "yMax":yMax})
|
| 116 |
return redirect(url_for('tagger'))
|
| 117 |
|
|
|
|
| 118 |
@app.route('/remove/<id>')
|
| 119 |
def remove(id):
|
| 120 |
index = int(id) - 1
|
|
@@ -123,12 +126,14 @@ def remove(id):
|
|
| 123 |
label["id"] = str(int(label["id"]) - 1)
|
| 124 |
return redirect(url_for('tagger'))
|
| 125 |
|
|
|
|
| 126 |
@app.route('/label/<id>')
|
| 127 |
def label(id):
|
| 128 |
name = request.args.get("name")
|
| 129 |
app.config["LABELS"][int(id) - 1]["name"] = name
|
| 130 |
return redirect(url_for('tagger'))
|
| 131 |
|
|
|
|
| 132 |
@app.route('/image/<f>')
|
| 133 |
def images(f):
|
| 134 |
user_id = session.get('_id')
|
|
@@ -136,6 +141,7 @@ def images(f):
|
|
| 136 |
img_path = os.path.join(img_dir, f'{f}')
|
| 137 |
return send_file(img_path)
|
| 138 |
|
|
|
|
| 139 |
@app.route('/download')
|
| 140 |
def download():
|
| 141 |
user_id = session.get('_id')
|
|
@@ -163,5 +169,6 @@ def download():
|
|
| 163 |
download_name='annotated_data.zip',
|
| 164 |
as_attachment=True)
|
| 165 |
|
|
|
|
| 166 |
if __name__ == "__main__":
|
| 167 |
-
app.run(debug="True")
|
|
|
|
| 102 |
app.config["LABELS"] = []
|
| 103 |
return redirect(url_for('tagger'))
|
| 104 |
|
| 105 |
+
|
| 106 |
@app.route("/final")
|
| 107 |
def final():
|
| 108 |
return render_template('final.html')
|
| 109 |
|
| 110 |
+
|
| 111 |
@app.route('/add/<id>')
|
| 112 |
def add(id):
|
| 113 |
xMin = request.args.get("xMin")
|
|
|
|
| 117 |
app.config["LABELS"].append({"id":id, "name":"", "xMin":xMin, "xMax":xMax, "yMin":yMin, "yMax":yMax})
|
| 118 |
return redirect(url_for('tagger'))
|
| 119 |
|
| 120 |
+
|
| 121 |
@app.route('/remove/<id>')
|
| 122 |
def remove(id):
|
| 123 |
index = int(id) - 1
|
|
|
|
| 126 |
label["id"] = str(int(label["id"]) - 1)
|
| 127 |
return redirect(url_for('tagger'))
|
| 128 |
|
| 129 |
+
|
| 130 |
@app.route('/label/<id>')
|
| 131 |
def label(id):
|
| 132 |
name = request.args.get("name")
|
| 133 |
app.config["LABELS"][int(id) - 1]["name"] = name
|
| 134 |
return redirect(url_for('tagger'))
|
| 135 |
|
| 136 |
+
|
| 137 |
@app.route('/image/<f>')
|
| 138 |
def images(f):
|
| 139 |
user_id = session.get('_id')
|
|
|
|
| 141 |
img_path = os.path.join(img_dir, f'{f}')
|
| 142 |
return send_file(img_path)
|
| 143 |
|
| 144 |
+
|
| 145 |
@app.route('/download')
|
| 146 |
def download():
|
| 147 |
user_id = session.get('_id')
|
|
|
|
| 169 |
download_name='annotated_data.zip',
|
| 170 |
as_attachment=True)
|
| 171 |
|
| 172 |
+
|
| 173 |
if __name__ == "__main__":
|
| 174 |
+
app.run(debug="True")
|