DmitrMakeev
commited on
Commit
•
cd1e41a
1
Parent(s):
900d205
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,8 @@ IMAGE_FILENAME = 'latest_image.jpg'
|
|
26 |
if not os.path.exists(UPLOAD_FOLDER):
|
27 |
os.makedirs(UPLOAD_FOLDER)
|
28 |
|
|
|
|
|
29 |
@app.route('/upload', methods=['POST'])
|
30 |
def upload_file():
|
31 |
if 'photo' not in request.files:
|
@@ -33,8 +35,10 @@ def upload_file():
|
|
33 |
file = request.files['photo']
|
34 |
if file.filename == '':
|
35 |
return "No selected file", 400
|
36 |
-
|
37 |
-
|
|
|
|
|
38 |
|
39 |
|
40 |
@app.route('/image', methods=['GET'])
|
|
|
26 |
if not os.path.exists(UPLOAD_FOLDER):
|
27 |
os.makedirs(UPLOAD_FOLDER)
|
28 |
|
29 |
+
import os
|
30 |
+
|
31 |
@app.route('/upload', methods=['POST'])
|
32 |
def upload_file():
|
33 |
if 'photo' not in request.files:
|
|
|
35 |
file = request.files['photo']
|
36 |
if file.filename == '':
|
37 |
return "No selected file", 400
|
38 |
+
save_path = os.path.join(UPLOAD_FOLDER, file.filename)
|
39 |
+
file.save(save_path)
|
40 |
+
return f"File uploaded successfully and saved to {save_path}", 200
|
41 |
+
|
42 |
|
43 |
|
44 |
@app.route('/image', methods=['GET'])
|