Plana-Archive commited on
Commit
32b55aa
·
verified ·
1 Parent(s): 153b4d1

Upload real_object_detection/app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. real_object_detection/app.py +48 -0
real_object_detection/app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import gradio as gr
4
+ from imgutils.generic import YOLOModel
5
+
6
+ _GLOBAL_CSS = """
7
+ .limit-height {
8
+ max-height: 55vh;
9
+ }
10
+ """
11
+
12
+ if __name__ == '__main__':
13
+ with gr.Blocks(css=_GLOBAL_CSS) as demo:
14
+ with gr.Row():
15
+ with gr.Column():
16
+ gr.HTML('<h2 style="text-align: center;">Object Detections For Real Photos</h2>')
17
+ gr.Markdown('This is the online demo for detection functions of '
18
+ '[imgutils.detect](https://dghs-imgutils.deepghs.org/main/api_doc/detect/index.html). '
19
+ 'You can try them yourselves with `pip install dghs-imgutils`.')
20
+
21
+ with gr.Row():
22
+ with gr.Tabs():
23
+ with gr.Tab('Face Detection'):
24
+ YOLOModel('deepghs/real_face_detection').make_ui(
25
+ default_model_name='face_detect_v0_s_yv11',
26
+ default_conf_threshold=0.25,
27
+ )
28
+ with gr.Tab('Face Detection (Real Only)'):
29
+ YOLOModel('deepghs/yolo-face').make_ui(
30
+ default_model_name='yolov10s-face',
31
+ )
32
+ with gr.Tab('Head Detection'):
33
+ YOLOModel('deepghs/real_head_detection').make_ui(
34
+ default_model_name='head_detect_v0_s_yv11',
35
+ default_conf_threshold=0.18,
36
+ )
37
+ with gr.Tab('Person Detection'):
38
+ YOLOModel('deepghs/real_person_detection').make_ui(
39
+ default_model_name='person_detect_v0_s_yv11',
40
+ default_conf_threshold=0.35,
41
+ )
42
+ with gr.Tab('Generic'):
43
+ YOLOModel('deepghs/yolos').make_ui(
44
+ default_model_name='yolo11s',
45
+ )
46
+
47
+
48
+ demo.queue(os.cpu_count()).launch()