import gradio import os from tops.config import instantiate import gradio.inputs os.system("pip install --upgrade pip") os.system("pip install ftfy regex tqdm") os.system("pip install --no-deps git+https://github.com/openai/CLIP.git") os.system("pip install git+https://github.com/facebookresearch/detectron2@96c752ce821a3340e27edd51c28a00665dd32a30#subdirectory=projects/DensePose") os.system("pip install --no-deps git+https://github.com/hukkelas/DSFD-Pytorch-Inference") os.environ["TORCH_HOME"] = "torch_home" from dp2 import utils from gradio_demos.modules import ExampleDemo, WebcamDemo cfg_face = utils.load_config("configs/anonymizers/face.py") anonymizer_face = instantiate(cfg_face.anonymizer, load_cache=False) anonymizer_face.initialize_tracker(fps=1) with gradio.Blocks() as demo: gradio.Markdown("#
DeepPrivacy2 - Realistic Image Anonymization
") gradio.Markdown("###
Håkon Hukkelås, Rudolf Mester, Frank Lindseth
") gradio.Markdown("
See more information at: https://github.com/hukkelas/deep_privacy2
") gradio.Markdown("
For a demo of full-body anonymization, see: https://huggingface.co/spaces/haakohu/deep_privacy2
") with gradio.Tab("Webcam"): ExampleDemo(anonymizer_face) with gradio.Tab("File Upload"): ExampleDemo(anonymizer_face, source=None) demo.launch()