Spaces:
Paused
Paused
Download app.py from yangcsu/facialdetection-vgg: direct link, hf CLI and curl.
- Browser
- Download file 890 Bytes
-
https://huggingface.co/spaces/yangcsu/facialdetection-vgg/resolve/main/app.py
- Command line
-
hf download hf://spaces/yangcsu/facialdetection-vgg/app.py
-
curl -L -o app.py https://huggingface.co/spaces/yangcsu/facialdetection-vgg/resolve/main/app.py
890 Bytes
| import gradio as gr | |
| import os | |
| from src.detection import Detector | |
| # UGC: Define the inference fn() for your models | |
| def model_inference(image): | |
| image, json_out = Detector('BlazeFace')(image) | |
| return image | |
| def clear_all(): | |
| return None, None, None | |
| # 下载模型 | |
| os.system("wget -c https://huggingface.co/yangcsu/facialdetection-vgg/resolve/main/vgg.pdparams -P ./configs") | |
| os.system("wget -c https://huggingface.co/yangcsu/facialdetection-vgg/resolve/main/model.pdiparams -P ./configs") | |
| os.system("wget -c https://huggingface.co/yangcsu/facialdetection-vgg/resolve/main/model.pdmodel -P ./configs") | |
| examples = [ | |
| "images/1.jpg", | |
| "images/2.jpg", | |
| "images/3.jpg", | |
| ] | |
| title = "BlazeFace+VGG的人脸表情分析" | |
| demo = gr.Interface(fn=model_inference, inputs="image", outputs="image", title=title, | |
| examples=examples) | |
| # 启动Gradio | |
| demo.launch() | |