Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
import os
|
| 2 |
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
_GLOBAL_CSS = """
|
| 7 |
.limit-height {
|
|
@@ -9,26 +11,34 @@ _GLOBAL_CSS = """
|
|
| 9 |
}
|
| 10 |
"""
|
| 11 |
|
| 12 |
-
eyes_detector = EyesDetection()
|
| 13 |
-
|
| 14 |
-
@spaces.GPU
|
| 15 |
-
def run_detection(img):
|
| 16 |
-
return eyes_detector.detect(img, model_name="eye_detect_v1.0_s") # This function must exist in your class
|
| 17 |
-
|
| 18 |
if __name__ == '__main__':
|
| 19 |
with gr.Blocks(css=_GLOBAL_CSS) as demo:
|
| 20 |
with gr.Row():
|
| 21 |
with gr.Column():
|
| 22 |
gr.HTML('<h2 style="text-align: center;">Object Detections For Anime</h2>')
|
| 23 |
-
gr.Markdown('This is the online demo for detection functions
|
|
|
|
|
|
|
| 24 |
|
| 25 |
with gr.Row():
|
| 26 |
with gr.Tabs():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
with gr.Tab('Eyes Detection'):
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
demo.queue(os.cpu_count()).launch()
|
|
|
|
| 1 |
import os
|
| 2 |
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
+
|
| 5 |
+
from detection import EyesDetection, FaceDetection, HeadDetection, PersonDetection, HandDetection, CensorDetection, \
|
| 6 |
+
HalfBodyDetection, NudeNetDetection, BooruYOLODetection
|
| 7 |
|
| 8 |
_GLOBAL_CSS = """
|
| 9 |
.limit-height {
|
|
|
|
| 11 |
}
|
| 12 |
"""
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
if __name__ == '__main__':
|
| 15 |
with gr.Blocks(css=_GLOBAL_CSS) as demo:
|
| 16 |
with gr.Row():
|
| 17 |
with gr.Column():
|
| 18 |
gr.HTML('<h2 style="text-align: center;">Object Detections For Anime</h2>')
|
| 19 |
+
gr.Markdown('This is the online demo for detection functions of '
|
| 20 |
+
'[imgutils.detect](https://dghs-imgutils.deepghs.org/main/api_doc/detect/index.html). '
|
| 21 |
+
'You can try them yourselves with `pip install dghs-imgutils`.')
|
| 22 |
|
| 23 |
with gr.Row():
|
| 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()
|