Spaces:
Running
Running
narugo1992
commited on
Commit
•
495db77
1
Parent(s):
40de271
dev(narugo): update the GUI
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import re
|
2 |
from functools import lru_cache
|
3 |
from typing import List, Mapping, Tuple
|
@@ -85,21 +86,29 @@ def image_to_deepdanbooru_tags(image: Image.Image, threshold: float,
|
|
85 |
|
86 |
|
87 |
if __name__ == '__main__':
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
import re
|
3 |
from functools import lru_cache
|
4 |
from typing import List, Mapping, Tuple
|
|
|
86 |
|
87 |
|
88 |
if __name__ == '__main__':
|
89 |
+
with gr.Blocks() as demo:
|
90 |
+
with gr.Row():
|
91 |
+
with gr.Column():
|
92 |
+
gr_input_image = gr.Image(type='pil', label='Original Image')
|
93 |
+
gr_threshold = gr.Slider(0.0, 1.0, 0.5, label='Tagging Confidence Threshold')
|
94 |
+
with gr.Row():
|
95 |
+
gr_space = gr.Checkbox(value=False, label='Use Space Instead Of _')
|
96 |
+
gr_escape = gr.Checkbox(value=True, label='Use Text Escape')
|
97 |
+
gr_confidence = gr.Checkbox(value=False, label='Keep Confidences')
|
98 |
+
gr_order = gr.Checkbox(value=True, label='Descend By Confidence')
|
99 |
+
|
100 |
+
gr_btn_submit = gr.Button(value='Tagging', variant='primary')
|
101 |
+
|
102 |
+
with gr.Column():
|
103 |
+
with gr.Tabs():
|
104 |
+
with gr.Tab("Tags"):
|
105 |
+
gr_tags = gr.Label(label='Tags')
|
106 |
+
with gr.Tab("Exported Text"):
|
107 |
+
gr_output_text = gr.TextArea(label='Exported Text')
|
108 |
+
|
109 |
+
gr_btn_submit.click(
|
110 |
+
image_to_deepdanbooru_tags,
|
111 |
+
inputs=[gr_input_image, gr_threshold, gr_space, gr_escape, gr_confidence, gr_order],
|
112 |
+
outputs=[gr_output_text, gr_tags],
|
113 |
+
)
|
114 |
+
demo.queue(os.cpu_count()).launch()
|