Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -99,5 +99,39 @@ with gr.Blocks(css= "style.css") as app:
|
|
| 99 |
|
| 100 |
controlnet_button.click(fn=controlnet_process_func, inputs=[controlnet_image_input, controlnet_dropdown, model_dropdown, vae_dropdown], outputs=controlnet_output_image)
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
# Jalankan antarmuka
|
| 103 |
app.launch()
|
|
|
|
| 99 |
|
| 100 |
controlnet_button.click(fn=controlnet_process_func, inputs=[controlnet_image_input, controlnet_dropdown, model_dropdown, vae_dropdown], outputs=controlnet_output_image)
|
| 101 |
|
| 102 |
+
# Tab untuk Describe
|
| 103 |
+
with gr.Tab("Describe"):
|
| 104 |
+
# Components
|
| 105 |
+
image = gr.Image(type="pil", image_mode="RGBA", label="Input")
|
| 106 |
+
model_repo = gr.Dropdown(dropdown_list, value=SWINV2_MODEL_DSV3_REPO, label="Model")
|
| 107 |
+
general_thresh = gr.Slider(0, 1, step=args.score_slider_step, value=args.score_general_threshold, label="General Tags Threshold", scale=3)
|
| 108 |
+
general_mcut_enabled = gr.Checkbox(value=False, label="Use MCut threshold", scale=1)
|
| 109 |
+
character_thresh = gr.Slider(0, 1, step=args.score_slider_step, value=args.score_character_threshold, label="Character Tags Threshold", scale=3)
|
| 110 |
+
character_mcut_enabled = gr.Checkbox(value=False, label="Use MCut threshold", scale=1)
|
| 111 |
+
clear_button = gr.ClearButton(components=[image, model_repo, general_thresh, general_mcut_enabled, character_thresh, character_mcut_enabled], variant="secondary", size="lg")
|
| 112 |
+
submit_button = gr.Button(value="Submit", variant="primary", size="lg")
|
| 113 |
+
sorted_general_strings = gr.Textbox(label="Output (string)")
|
| 114 |
+
rating = gr.Label(label="Rating")
|
| 115 |
+
character_res = gr.Label(label="Output (characters)")
|
| 116 |
+
general_res = gr.Label(label="Output (tags)")
|
| 117 |
+
# Layout
|
| 118 |
+
with gr.Row():
|
| 119 |
+
with gr.Column(variant="panel"):
|
| 120 |
+
image.render()
|
| 121 |
+
model_repo.render()
|
| 122 |
+
general_thresh.render()
|
| 123 |
+
general_mcut_enabled.render()
|
| 124 |
+
character_thresh.render()
|
| 125 |
+
character_mcut_enabled.render()
|
| 126 |
+
clear_button.render()
|
| 127 |
+
submit_button.render()
|
| 128 |
+
with gr.Column(variant="panel"):
|
| 129 |
+
sorted_general_strings.render()
|
| 130 |
+
rating.render()
|
| 131 |
+
character_res.render()
|
| 132 |
+
general_res.render()
|
| 133 |
+
clear_button.add([sorted_general_strings, rating, character_res, general_res])
|
| 134 |
+
submit_button.click(predictor.predict, inputs=[image, model_repo, general_thresh, general_mcut_enabled, character_thresh, character_mcut_enabled], outputs=[sorted_general_strings, rating, character_res, general_res])
|
| 135 |
+
|
| 136 |
# Jalankan antarmuka
|
| 137 |
app.launch()
|