Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,18 @@ from concurrent.futures import ThreadPoolExecutor
|
|
6 |
|
7 |
fawkes_protection = FawkesProtection()
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
def process_images(image_files, protection_level):
|
10 |
-
|
11 |
with ThreadPoolExecutor() as executor:
|
12 |
-
futures = [executor.submit(
|
13 |
-
|
|
|
|
|
14 |
return results
|
15 |
|
16 |
iface = gr.Interface(
|
|
|
6 |
|
7 |
fawkes_protection = FawkesProtection()
|
8 |
|
9 |
+
def process_image(file, protection_level):
|
10 |
+
image = Image.open(file)
|
11 |
+
protected_image = fawkes_protection.predict(image, protection_level)
|
12 |
+
return Image.fromarray(protected_image)
|
13 |
+
|
14 |
def process_images(image_files, protection_level):
|
15 |
+
results = []
|
16 |
with ThreadPoolExecutor() as executor:
|
17 |
+
futures = [executor.submit(process_image, file, protection_level) for file in image_files]
|
18 |
+
for future in futures:
|
19 |
+
result = future.result()
|
20 |
+
results.append(result)
|
21 |
return results
|
22 |
|
23 |
iface = gr.Interface(
|