Lambang commited on
Commit
07d4dbb
·
1 Parent(s): 1c98694
Files changed (1) hide show
  1. main.py +17 -17
main.py CHANGED
@@ -62,23 +62,23 @@ async def root():
62
  data_processor = DataProcessing()
63
  data_train_pred = TrainPred()
64
 
65
- # import random
66
- # def preprocessing(filepath):
67
- # folder_path = './static/temporary'
68
-
69
- # shutil.rmtree(folder_path)
70
- # os.mkdir(folder_path)
71
-
72
- # # data_processor.detect_landmark(data_processor.face_cropping_pred(filepath))
73
- # data_processor.enhance_contrast_histeq(data_processor.face_cropping_pred(filepath))
74
-
75
- # files = os.listdir(folder_path)
76
- # index = 0
77
- # for file_name in files:
78
- # file_ext = os.path.splitext(file_name)[1]
79
- # new_file_name = str(index) + "_" + str(random.randint(1, 100000)) + file_ext
80
- # os.rename(os.path.join(folder_path, file_name), os.path.join(folder_path, new_file_name))
81
- # index += 1
82
 
83
  # print("Tungu sampai selesaiii")
84
 
 
62
  data_processor = DataProcessing()
63
  data_train_pred = TrainPred()
64
 
65
+ import random
66
+ def preprocessing(filepath):
67
+ folder_path = './static/temporary'
68
+
69
+ shutil.rmtree(folder_path)
70
+ os.mkdir(folder_path)
71
+
72
+ # data_processor.detect_landmark(data_processor.face_cropping_pred(filepath))
73
+ data_processor.enhance_contrast_histeq(data_processor.face_cropping_pred(filepath))
74
+
75
+ files = os.listdir(folder_path)
76
+ index = 0
77
+ for file_name in files:
78
+ file_ext = os.path.splitext(file_name)[1]
79
+ new_file_name = str(index) + "_" + str(random.randint(1, 100000)) + file_ext
80
+ os.rename(os.path.join(folder_path, file_name), os.path.join(folder_path, new_file_name))
81
+ index += 1
82
 
83
  # print("Tungu sampai selesaiii")
84