Skip to content

Commit 822c66a

Browse files
updated server.py
1 parent 322bc58 commit 822c66a

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

backend/server.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
# adaug directorul parinte in calea de cautare a modulului, pentru a putea importa
88
# PARTEA COMENTATA MOMENTAN NU FUNCTIONEAZA
9-
# current_dir = os.path.dirname(os.path.abspath(__file__))
10-
# parent_dir = os.path.dirname(current_dir)
11-
# if parent_dir not in sys.path:
12-
# sys.path.insert(0, parent_dir)
13-
# from AI.main import classify_image_huggingface, classify_image_mediapipe
9+
current_dir = os.path.dirname(os.path.abspath(__file__))
10+
parent_dir = os.path.dirname(current_dir)
11+
if parent_dir not in sys.path:
12+
sys.path.insert(0, parent_dir)
13+
from AI.main import classify_image
1414
app = Flask(__name__)
1515
# setez directorul in care voi incarca pozele primite de camera din aplicatia flutter.
1616
UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'uploads')
@@ -62,16 +62,16 @@ def upload_file():
6262
else:
6363
return jsonify({'error': 'File type not allowed'}), 400
6464

65-
6665
# testata si ea cu postman.
6766
# Ruta de procesare a imaginii, se asteapta sa primeasca o cerere de genul:
6867
# {
69-
# "filename": "e28aaff68a034674b73bf9e945e2b5381.jpg"
68+
# "filename": "image_name.jpg"
7069
# }
7170

7271
# si rapsunsul corect ar fi fe genul:
7372
# {
74-
# "filename": "e28aaff68a034674b73bf9e945e2b5381.jpg",
73+
# "filename": "image_name.jpg",
74+
# "result_llm": [],
7575
# "message": "Image processed successfully"
7676
# }
7777
@app.route('/processing_translate', methods=['POST'])
@@ -91,16 +91,14 @@ def procesing_translate():
9191
if image_opencv is None:
9292
return jsonify({'error': 'Could not read the image'}), 400
9393

94-
# NU MERGE SA LE IMPORT.
9594
# result_huggingface = classify_image_huggingface(image_opencv)
96-
# result_mediapipe = classify_image_mediapipe(image_opencv)
97-
98-
# Poți returna un rezultat procesat
95+
# apelez functia din main.py de la llm.
96+
result_llm = classify_image(image_opencv)
9997
return jsonify({
10098
'message': 'Image processed successfully',
10199
'filename': filename,
102-
# 'huggingface_result': result_huggingface,
103-
# 'mediapipe_result': result_mediapipe
100+
'result_llm': result_llm
101+
# 'huggingface_result': result_huggingface
104102
}), 200
105103

106104
if __name__ == '__main__':

0 commit comments

Comments
 (0)