Spaces:
Runtime error
Runtime error
File size: 1,613 Bytes
31c6733 415d841 31c6733 ba7275c 4ba0e70 31c6733 cf05ed1 31c6733 97a6728 31c6733 415d841 31c6733 415d841 97a6728 31c6733 97a6728 415d841 11528d1 31c6733 415d841 31c6733 415d841 e24da0e 31c6733 e24da0e 31c6733 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import gradio
import sys
import os
from pathlib import Path
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")
sys.path.insert(0, Path(os.getcwd(), "deep_privacy"))
os.environ["TORCH_HOME"] = "torch_home"
from dp2 import utils
from gradio_demos.modules import ExampleDemo, WebcamDemo
cfg_face = utils.load_config("deep_privacy/configs/anonymizers/face.py")
for key in ["person_G_cfg", "cse_person_G_cfg", "face_G_cfg", "car_G_cfg"]:
if key in cfg_face.anonymizer:
cfg_face.anonymizer[key] = Path("deep_privacy", cfg_face.anonymizer[key])
anonymizer_face = instantiate(cfg_face.anonymizer, load_cache=False)
anonymizer_face.initialize_tracker(fps=1)
with gradio.Blocks() as demo:
gradio.Markdown("# <center> DeepPrivacy2 - Realistic Image Anonymization </center>")
gradio.Markdown("### <center> Håkon Hukkelås, Rudolf Mester, Frank Lindseth </center>")
gradio.Markdown("<center> See more information at: <a href='https://github.com/hukkelas/deep_privacy2'> https://github.com/hukkelas/deep_privacy2 </a> </center>")
with gradio.Tab("Face Anonymization"):
ExampleDemo(anonymizer_face)
with gradio.Tab("Live Webcam"):
WebcamDemo(anonymizer_face)
demo.launch()
|