@@ -31,35 +31,35 @@ def check_filename(filename):
3131@app .route ('/upload' , methods = ['POST' ])
3232def upload_file ():
3333 global cod_counter
34- # verific daca in cerere exista un fisier .
34+ # Check if a file is present in the request .
3535 if 'file' not in request .files :
3636 return jsonify ({'error' : 'No file part' }), 400
3737
3838 file = request .files ['file' ]
3939
4040 if file .filename == '' :
41- # in caz ca am un fisier gol:
41+ # In case we have an empty file.
4242 return jsonify ({'error' : 'No selected file' }), 400
4343
4444 if file and check_filename (file .filename ):
45- # am creat un hash unic pe care sa il apenduiesc in fata numelui fisierului, pentru
46- # ca daca il lasam fara, fisierele nu mai aveau denumiri distincte, si folderul
47- # ramanea mereu doar cu o poza, la fiecare incarcare a camerei din flutter .
45+ # Append the cod_counter to the filename because without it,
46+ # files wouldn't have distinct names, and the folder would
47+ # always have only one image with each camera upload from Flutter .
4848 filename = f"{ cod_counter } _{ file .filename } "
49- # concatenez cu un contor pentru ca altfel, imi punea pozele
50- # distincte ca acelasi obiect file in folder.
49+ # Concatenate with a counter because otherwise, it would place
50+ # different images as the same file object in the folder.
5151 file .save (os .path .join (app .config ['UPLOAD_FOLDER' ], filename ))
5252 cod_counter += 1
5353 return jsonify ({'message' : 'File uploaded successfully!' }), 200
5454 else :
5555 return jsonify ({'error' : 'File type not allowed' }), 400
5656
57- # Ruta de procesare a imaginii, se asteapta sa primeasca o cerere de genul :
57+ # Image processing route, expecting to receive a request like :
5858# {
5959# "filename": "image_name.jpg"
6060# }
6161
62- # si rapsunsul corect ar fi fe genul :
62+ # And the correct response would be something like :
6363# {
6464# "filename": "image_name.jpg",
6565# "result_llm": [],
0 commit comments