Update app.py
Browse files
app.py
CHANGED
|
@@ -259,7 +259,19 @@ def create_cam_visualization_pil(image_pil, cam, alpha=0.6, vis_threshold=0.2):
|
|
| 259 |
|
| 260 |
return composite
|
| 261 |
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
gr.Markdown("""
|
| 264 |
## Joint Tagger Project: JTP-PILOT² Demo **BETA**
|
| 265 |
This tagger is designed for use on furry images (though may very well work on out-of-distribution images, potentially with funny results). A threshold of 0.2 is recommended. Lower thresholds often turn up more valid tags, but can also result in some amount of hallucinated tags.
|
|
@@ -274,17 +286,7 @@ with gr.Blocks(css=".output-class { display: none; }") as demo:
|
|
| 274 |
sorted_tag_score_state = gr.State(value={}) # stash a copy of the input image
|
| 275 |
cam_state = gr.State()
|
| 276 |
with gr.Row():
|
| 277 |
-
|
| 278 |
-
.inferno-slider input[type=range] {
|
| 279 |
-
background: linear-gradient(to right,
|
| 280 |
-
#000004, #1b0c41, #4a0c6b, #781c6d,
|
| 281 |
-
#a52c60, #cf4446, #ed6925, #fb9b06,
|
| 282 |
-
#f7d13d, #fcffa4
|
| 283 |
-
) !important;
|
| 284 |
-
background-size: 100% 100% !important;
|
| 285 |
-
}
|
| 286 |
-
"""
|
| 287 |
-
with gr.Column(css=custom_css):
|
| 288 |
image_input = gr.Image(label="Source", sources=['upload'], type='pil', height=512, show_label=False)
|
| 289 |
threshold_slider = gr.Slider(minimum=0.00, maximum=1.00, step=0.01, value=0.20, label="Tag Threshold")
|
| 290 |
cam_slider = gr.Slider(minimum=0.00, maximum=1.00, step=0.01, value=0.40, label="CAM Threshold", elem_classes="inferno-slider")
|
|
|
|
| 259 |
|
| 260 |
return composite
|
| 261 |
|
| 262 |
+
custom_css = """
|
| 263 |
+
.output-class { display: none; }
|
| 264 |
+
.inferno-slider input[type=range] {
|
| 265 |
+
background: linear-gradient(to right,
|
| 266 |
+
#000004, #1b0c41, #4a0c6b, #781c6d,
|
| 267 |
+
#a52c60, #cf4446, #ed6925, #fb9b06,
|
| 268 |
+
#f7d13d, #fcffa4
|
| 269 |
+
) !important;
|
| 270 |
+
background-size: 100% 100% !important;
|
| 271 |
+
}
|
| 272 |
+
"""
|
| 273 |
+
|
| 274 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 275 |
gr.Markdown("""
|
| 276 |
## Joint Tagger Project: JTP-PILOT² Demo **BETA**
|
| 277 |
This tagger is designed for use on furry images (though may very well work on out-of-distribution images, potentially with funny results). A threshold of 0.2 is recommended. Lower thresholds often turn up more valid tags, but can also result in some amount of hallucinated tags.
|
|
|
|
| 286 |
sorted_tag_score_state = gr.State(value={}) # stash a copy of the input image
|
| 287 |
cam_state = gr.State()
|
| 288 |
with gr.Row():
|
| 289 |
+
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
image_input = gr.Image(label="Source", sources=['upload'], type='pil', height=512, show_label=False)
|
| 291 |
threshold_slider = gr.Slider(minimum=0.00, maximum=1.00, step=0.01, value=0.20, label="Tag Threshold")
|
| 292 |
cam_slider = gr.Slider(minimum=0.00, maximum=1.00, step=0.01, value=0.40, label="CAM Threshold", elem_classes="inferno-slider")
|