| import os |
|
|
| import gradio as gr |
| from imgutils.generic import YOLOModel |
|
|
| _GLOBAL_CSS = """ |
| .limit-height { |
| max-height: 55vh; |
| } |
| """ |
|
|
| if __name__ == '__main__': |
| with gr.Blocks(css=_GLOBAL_CSS) as demo: |
| with gr.Row(): |
| with gr.Column(): |
| gr.HTML('<h2 style="text-align: center;">Object Detections For Real Photos</h2>') |
| gr.Markdown('This is the online demo for detection functions of ' |
| '[imgutils.detect](https://dghs-imgutils.deepghs.org/main/api_doc/detect/index.html). ' |
| 'You can try them yourselves with `pip install dghs-imgutils`.') |
|
|
| with gr.Row(): |
| with gr.Tabs(): |
| with gr.Tab('Face Detection'): |
| YOLOModel('deepghs/real_face_detection').make_ui( |
| default_model_name='face_detect_v0_s_yv11', |
| default_conf_threshold=0.25, |
| ) |
| with gr.Tab('Face Detection (Real Only)'): |
| YOLOModel('deepghs/yolo-face').make_ui( |
| default_model_name='yolov10s-face', |
| ) |
| with gr.Tab('Head Detection'): |
| YOLOModel('deepghs/real_head_detection').make_ui( |
| default_model_name='head_detect_v0_s_yv11', |
| default_conf_threshold=0.18, |
| ) |
| with gr.Tab('Person Detection'): |
| YOLOModel('deepghs/real_person_detection').make_ui( |
| default_model_name='person_detect_v0_s_yv11', |
| default_conf_threshold=0.35, |
| ) |
| with gr.Tab('Generic'): |
| YOLOModel('deepghs/yolos').make_ui( |
| default_model_name='yolo11s', |
| ) |
| |
|
|
| demo.queue(os.cpu_count()).launch() |
|
|