Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -90,8 +90,10 @@ def download_gitlab_repo():
|
|
| 90 |
)
|
| 91 |
print("Upload complete")
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
| 95 |
print("inner method of get all files in folder")
|
| 96 |
target_dir = os.path.join(temp_dir, partial_path)
|
| 97 |
print(target_dir)
|
|
@@ -104,18 +106,10 @@ def get_all_files_in_folder(temp_dir, partial_paths):
|
|
| 104 |
|
| 105 |
return all_files
|
| 106 |
|
| 107 |
-
|
| 108 |
def get_file(temp_dir, file_path):
|
| 109 |
full_path = os.path.join(temp_dir, file_path)
|
| 110 |
return full_path
|
| 111 |
|
| 112 |
-
def find_folder_path(root_directory, target_folder):
|
| 113 |
-
for root, dirs, _ in os.walk(root_directory):
|
| 114 |
-
if target_folder in dirs:
|
| 115 |
-
folder_path = os.path.join(root, target_folder)
|
| 116 |
-
return folder_path
|
| 117 |
-
return
|
| 118 |
-
|
| 119 |
|
| 120 |
def process_directory(directory, partial_paths=None, file_paths=None):
|
| 121 |
all_texts = []
|
|
@@ -150,14 +144,15 @@ def process_directory(directory, partial_paths=None, file_paths=None):
|
|
| 150 |
|
| 151 |
if partial_paths:
|
| 152 |
print("Go in partial_paths")
|
| 153 |
-
for
|
| 154 |
-
files += get_all_files_in_folder(tmpsubdirpath,
|
|
|
|
| 155 |
else:
|
| 156 |
print("wtf")
|
| 157 |
for root, _, files_list in os.walk(tmpdirname):
|
| 158 |
for file in files_list:
|
| 159 |
files.append(os.path.join(root, file))
|
| 160 |
-
|
| 161 |
if file_paths:
|
| 162 |
print("Go in normal paths")
|
| 163 |
files += [get_file(tmpdirname, file_path) for file_path in file_paths]
|
|
|
|
| 90 |
)
|
| 91 |
print("Upload complete")
|
| 92 |
|
| 93 |
+
|
| 94 |
+
def get_all_files_in_folder(temp_dir, partial_path):
|
| 95 |
+
|
| 96 |
+
all_files = []
|
| 97 |
print("inner method of get all files in folder")
|
| 98 |
target_dir = os.path.join(temp_dir, partial_path)
|
| 99 |
print(target_dir)
|
|
|
|
| 106 |
|
| 107 |
return all_files
|
| 108 |
|
|
|
|
| 109 |
def get_file(temp_dir, file_path):
|
| 110 |
full_path = os.path.join(temp_dir, file_path)
|
| 111 |
return full_path
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
def process_directory(directory, partial_paths=None, file_paths=None):
|
| 115 |
all_texts = []
|
|
|
|
| 144 |
|
| 145 |
if partial_paths:
|
| 146 |
print("Go in partial_paths")
|
| 147 |
+
for partial_path in partial_paths:
|
| 148 |
+
files += get_all_files_in_folder(tmpsubdirpath, partial_path)
|
| 149 |
+
|
| 150 |
else:
|
| 151 |
print("wtf")
|
| 152 |
for root, _, files_list in os.walk(tmpdirname):
|
| 153 |
for file in files_list:
|
| 154 |
files.append(os.path.join(root, file))
|
| 155 |
+
|
| 156 |
if file_paths:
|
| 157 |
print("Go in normal paths")
|
| 158 |
files += [get_file(tmpdirname, file_path) for file_path in file_paths]
|