Spaces:
Paused
Paused
| 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() | |