narugo commited on
Commit
fb39199
·
verified ·
1 Parent(s): ef4f1c9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # HeadDetection().make_ui()
34
+ # with gr.Tab('Person Detection'):
35
+ # PersonDetection().make_ui()
36
+ with gr.Tab('Generic'):
37
+ YOLOModel('deepghs/yolos').make_ui(
38
+ default_model_name='yolo11s',
39
+ )
40
+
41
+
42
+ demo.queue(os.cpu_count()).launch()