Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -159,31 +159,20 @@ class ExampleDemo(WebcamDemo):
|
|
159 |
def __init__(self, anonymizer) -> None:
|
160 |
self.anonymizer = anonymizer
|
161 |
with gradio.Row():
|
162 |
-
input_image = gradio.Image(type="pil",
|
163 |
output_image = gradio.Image(type="numpy", label="Output")
|
164 |
with gradio.Row():
|
165 |
update_btn = gradio.Button("Update Anonymization").style(full_width=True)
|
166 |
visualize_det = gradio.Checkbox(value=False, label="Show Detections")
|
167 |
visualize_det.change(self.anonymize, inputs=[input_image, visualize_det], outputs=[output_image])
|
|
|
|
|
|
|
168 |
update_btn.click(self.anonymize, inputs=[input_image, visualize_det], outputs=[output_image])
|
169 |
input_image.change(self.anonymize, inputs=[input_image, visualize_det], outputs=[output_image])
|
170 |
self.track = False
|
171 |
|
172 |
|
173 |
-
class Information:
|
174 |
-
|
175 |
-
def __init__(self) -> None:
|
176 |
-
gradio.Markdown("## <center> Face Anonymization Architecture </center>")
|
177 |
-
gradio.Markdown("---")
|
178 |
-
gradio.Image(value="media2/overall_architecture.png")
|
179 |
-
gradio.Markdown("## <center> Full-Body Anonymization Architecture </center>")
|
180 |
-
gradio.Markdown("---")
|
181 |
-
gradio.Image(value="media2/full_body.png")
|
182 |
-
gradio.Markdown("### <center> Generative Adversarial Networks </center>")
|
183 |
-
gradio.Markdown("---")
|
184 |
-
gradio.Image(value="media2/gan_architecture.png")
|
185 |
-
|
186 |
-
|
187 |
def pil2torch(img: Image.Image):
|
188 |
img = img.convert("RGB")
|
189 |
img = np.array(img)
|
@@ -194,9 +183,9 @@ def pil2torch(img: Image.Image):
|
|
194 |
with gradio.Blocks() as demo:
|
195 |
gradio.Markdown("# <center> DeepPrivacy2 - Realistic Image Anonymization </center>")
|
196 |
gradio.Markdown("### <center> Håkon Hukkelås, Rudolf Mester, Frank Lindseth </center>")
|
197 |
-
with gradio.Tab("
|
198 |
ExampleDemo(anonymizer_body)
|
199 |
-
with gradio.Tab("
|
200 |
ExampleDemo(anonymizer_face)
|
201 |
|
202 |
|
|
|
159 |
def __init__(self, anonymizer) -> None:
|
160 |
self.anonymizer = anonymizer
|
161 |
with gradio.Row():
|
162 |
+
input_image = gradio.Image(type="pil", label="Upload your image or try the example below!")
|
163 |
output_image = gradio.Image(type="numpy", label="Output")
|
164 |
with gradio.Row():
|
165 |
update_btn = gradio.Button("Update Anonymization").style(full_width=True)
|
166 |
visualize_det = gradio.Checkbox(value=False, label="Show Detections")
|
167 |
visualize_det.change(self.anonymize, inputs=[input_image, visualize_det], outputs=[output_image])
|
168 |
+
gradio.Examples(
|
169 |
+
["erling.jpg", "coco_val2017_000000001000.jpg"], inputs=[input_image]
|
170 |
+
)
|
171 |
update_btn.click(self.anonymize, inputs=[input_image, visualize_det], outputs=[output_image])
|
172 |
input_image.change(self.anonymize, inputs=[input_image, visualize_det], outputs=[output_image])
|
173 |
self.track = False
|
174 |
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
def pil2torch(img: Image.Image):
|
177 |
img = img.convert("RGB")
|
178 |
img = np.array(img)
|
|
|
183 |
with gradio.Blocks() as demo:
|
184 |
gradio.Markdown("# <center> DeepPrivacy2 - Realistic Image Anonymization </center>")
|
185 |
gradio.Markdown("### <center> Håkon Hukkelås, Rudolf Mester, Frank Lindseth </center>")
|
186 |
+
with gradio.Tab("Full-Body Anonymization"):
|
187 |
ExampleDemo(anonymizer_body)
|
188 |
+
with gradio.Tab("Face Anonymization"):
|
189 |
ExampleDemo(anonymizer_face)
|
190 |
|
191 |
|