Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -124,6 +124,31 @@ def calc_emb_cropped(image, app, min_bbox_ratio=0.2):
|
|
124 |
|
125 |
return cropped_face_image
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
def make_canny_condition(image, min_val=100, max_val=200, w_bilateral=True):
|
128 |
if w_bilateral:
|
129 |
image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2GRAY)
|
@@ -166,6 +191,13 @@ for file in files_in_dir:
|
|
166 |
print(f"Downloading: {file}")
|
167 |
hf_hub_download(repo_id=repo_id, filename=file, local_dir=os.path.dirname(local_path))
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
app = FaceAnalysis(name='auraface', root='./checkpoints/models_aura/', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
|
170 |
app.prepare(ctx_id=0, det_size=(640, 640))
|
171 |
|
|
|
124 |
|
125 |
return cropped_face_image
|
126 |
|
127 |
+
def print_tree(root_dir, prefix=""):
|
128 |
+
"""
|
129 |
+
Recursively prints the directory structure starting from `root_dir`.
|
130 |
+
|
131 |
+
Args:
|
132 |
+
root_dir (str): Path to the root directory.
|
133 |
+
prefix (str): Prefix for formatting the tree structure.
|
134 |
+
"""
|
135 |
+
# List all files and directories in the current folder
|
136 |
+
items = os.listdir(root_dir)
|
137 |
+
items.sort() # Sort for consistent output
|
138 |
+
|
139 |
+
for i, item in enumerate(items):
|
140 |
+
path = os.path.join(root_dir, item)
|
141 |
+
is_last = (i == len(items) - 1)
|
142 |
+
|
143 |
+
# Print item name with tree branch
|
144 |
+
print(f"{prefix}{'└── ' if is_last else '├── '}{item}")
|
145 |
+
|
146 |
+
# If the item is a directory, recurse into it
|
147 |
+
if os.path.isdir(path):
|
148 |
+
print_tree(path, prefix + (" " if is_last else "│ "))
|
149 |
+
|
150 |
+
|
151 |
+
|
152 |
def make_canny_condition(image, min_val=100, max_val=200, w_bilateral=True):
|
153 |
if w_bilateral:
|
154 |
image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2GRAY)
|
|
|
191 |
print(f"Downloading: {file}")
|
192 |
hf_hub_download(repo_id=repo_id, filename=file, local_dir=os.path.dirname(local_path))
|
193 |
|
194 |
+
|
195 |
+
# Local directory where files were downloaded
|
196 |
+
local_dir = "./checkpoints/models_aura"
|
197 |
+
|
198 |
+
print(f"Folder structure of '{local_dir}':")
|
199 |
+
print_tree(local_dir)
|
200 |
+
|
201 |
app = FaceAnalysis(name='auraface', root='./checkpoints/models_aura/', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
|
202 |
app.prepare(ctx_id=0, det_size=(640, 640))
|
203 |
|