Lambang commited on
Commit
35d5aad
·
1 Parent(s): 4ca19a4
Files changed (1) hide show
  1. main.py +4 -2
main.py CHANGED
@@ -69,7 +69,6 @@ def preprocessing(filepath):
69
  shutil.rmtree(folder_path)
70
  os.mkdir(folder_path)
71
 
72
- cv2.imwrite("./static/test_upload.jpg", filepath)
73
 
74
 
75
  # data_processor.detect_landmark(data_processor.face_cropping_pred(filepath))
@@ -101,7 +100,10 @@ async def upload_file(picture: UploadFile):
101
  raise HTTPException(status_code=400, detail='Invalid file extension')
102
 
103
  os.makedirs(UPLOAD_FOLDER, exist_ok=True)
104
- file_path = os.path.join(UPLOAD_FOLDER, secure_filename(picture.filename))
 
 
 
105
  with open(file_path, 'wb') as f:
106
  f.write(picture.file.read())
107
  try:
 
69
  shutil.rmtree(folder_path)
70
  os.mkdir(folder_path)
71
 
 
72
 
73
 
74
  # data_processor.detect_landmark(data_processor.face_cropping_pred(filepath))
 
100
  raise HTTPException(status_code=400, detail='Invalid file extension')
101
 
102
  os.makedirs(UPLOAD_FOLDER, exist_ok=True)
103
+ file_path = os.path.join(UPLOAD_FOLDER, (picture.filename))
104
+
105
+ cv2.imwrite("./static/test_upload.jpg", filepath)
106
+
107
  with open(file_path, 'wb') as f:
108
  f.write(picture.file.read())
109
  try: