Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,44 +1,21 @@
|
|
1 |
import os
|
2 |
import spaces
|
3 |
import gradio as gr
|
|
|
4 |
|
5 |
-
|
6 |
-
HalfBodyDetection, NudeNetDetection, BooruYOLODetection
|
7 |
|
8 |
-
|
9 |
-
.
|
10 |
-
|
11 |
-
|
12 |
-
"""
|
13 |
|
14 |
-
if __name__ ==
|
15 |
-
with gr.Blocks(
|
16 |
-
with gr.
|
17 |
-
with gr.
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
'You can try them yourselves with `pip install dghs-imgutils`.')
|
22 |
|
23 |
-
|
24 |
-
with gr.Tabs():
|
25 |
-
with gr.Tab('Face Detection'):
|
26 |
-
FaceDetection().make_ui()
|
27 |
-
with gr.Tab('Head Detection'):
|
28 |
-
HeadDetection().make_ui()
|
29 |
-
with gr.Tab('Person Detection'):
|
30 |
-
PersonDetection().make_ui()
|
31 |
-
with gr.Tab('Half Body Detection'):
|
32 |
-
HalfBodyDetection().make_ui()
|
33 |
-
with gr.Tab('Eyes Detection'):
|
34 |
-
EyesDetection().make_ui()
|
35 |
-
with gr.Tab('Hand Detection'):
|
36 |
-
HandDetection().make_ui()
|
37 |
-
with gr.Tab('Censor Point Detection'):
|
38 |
-
CensorDetection().make_ui()
|
39 |
-
with gr.Tab('NudeNet'):
|
40 |
-
NudeNetDetection().make_ui()
|
41 |
-
with gr.Tab('BooruYOLO'):
|
42 |
-
BooruYOLODetection().make_ui()
|
43 |
-
|
44 |
-
demo.queue(os.cpu_count()).launch(share=True)
|
|
|
1 |
import os
|
2 |
import spaces
|
3 |
import gradio as gr
|
4 |
+
from detection import EyesDetection
|
5 |
|
6 |
+
eyes_detector = EyesDetection()
|
|
|
7 |
|
8 |
+
# expose the heavy work so ZeroGPU sees it
|
9 |
+
@spaces.GPU
|
10 |
+
def _gpu_detect(img, m="eye_detect_v1.0_s"):
|
11 |
+
return eyes_detector.detect(img, model_name=m)
|
|
|
12 |
|
13 |
+
if __name__ == "__main__":
|
14 |
+
with gr.Blocks() as demo:
|
15 |
+
with gr.Tabs():
|
16 |
+
with gr.Tab("Eyes Detection"):
|
17 |
+
# the helper builds an image uploader, button,
|
18 |
+
# and nicely formatted results table
|
19 |
+
eyes_detector.make_ui(detect_fn=_gpu_detect)
|
|
|
20 |
|
21 |
+
demo.queue(os.cpu_count()).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|