Spaces:
Running
Running
Commit
·
6296cf9
1
Parent(s):
b7f6a68
update server
Browse files- constants.py +1 -0
- serve/gradio_web_i2s.py +124 -48
- serve/gradio_web_t2s.py +123 -49
- serve/inference.py +0 -4
- serve/utils.py +12 -12
- serve/vote_utils.py +9 -9
constants.py
CHANGED
|
@@ -21,6 +21,7 @@ SAVE_IMAGE = "save_image"
|
|
| 21 |
SAVE_LOG = "save_log"
|
| 22 |
|
| 23 |
NUM_SIDES = 2
|
|
|
|
| 24 |
TEXT_PROMPT_PATH = "offline/prompts_110.json"
|
| 25 |
IMAGE_PROMPT_PATH = "offline/image_urls.txt"
|
| 26 |
|
|
|
|
| 21 |
SAVE_LOG = "save_log"
|
| 22 |
|
| 23 |
NUM_SIDES = 2
|
| 24 |
+
EVALUATE_DIMS = 5
|
| 25 |
TEXT_PROMPT_PATH = "offline/prompts_110.json"
|
| 26 |
IMAGE_PROMPT_PATH = "offline/image_urls.txt"
|
| 27 |
|
serve/gradio_web_i2s.py
CHANGED
|
@@ -74,7 +74,20 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 74 |
with gr.Column():
|
| 75 |
model_selector_right = gr.Markdown("", visible=False)
|
| 76 |
with gr.Row():
|
| 77 |
-
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
with gr.Row(elem_id="Geometry Quality"):
|
| 80 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
|
@@ -102,8 +115,21 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 102 |
value="👎 Both are bad", visible=False, interactive=False
|
| 103 |
)
|
| 104 |
|
| 105 |
-
with gr.Row(elem_id="
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
align_leftvote_btn = gr.Button(
|
| 108 |
value="👈 A is better", visible=False, interactive=False
|
| 109 |
)
|
|
@@ -132,16 +158,19 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 132 |
|
| 133 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 134 |
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 137 |
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 138 |
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
| 142 |
|
| 143 |
-
for
|
| 144 |
-
[geo_md, text_md, align_md]):
|
| 145 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 146 |
|
| 147 |
leftvote_btn.click(
|
|
@@ -175,7 +204,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 175 |
imagebox.upload(
|
| 176 |
reset_states_side_by_side_anony,
|
| 177 |
states,
|
| 178 |
-
states + model_selectors +
|
| 179 |
).then(
|
| 180 |
gen_func,
|
| 181 |
states + [imagebox] + model_selectors,
|
|
@@ -184,17 +213,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 184 |
).then(
|
| 185 |
enable_mds,
|
| 186 |
None,
|
| 187 |
-
|
| 188 |
).then(
|
| 189 |
enable_buttons_side_by_side,
|
| 190 |
None,
|
| 191 |
-
|
| 192 |
)
|
| 193 |
|
| 194 |
send_btn.click(
|
| 195 |
reset_states_side_by_side_anony,
|
| 196 |
states,
|
| 197 |
-
states + model_selectors +
|
| 198 |
).then(
|
| 199 |
gen_func,
|
| 200 |
states + [imagebox] + model_selectors,
|
|
@@ -203,11 +232,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 203 |
).then(
|
| 204 |
enable_mds,
|
| 205 |
None,
|
| 206 |
-
|
| 207 |
).then(
|
| 208 |
enable_buttons_side_by_side,
|
| 209 |
None,
|
| 210 |
-
|
| 211 |
)
|
| 212 |
|
| 213 |
clear_btn.click(
|
|
@@ -218,17 +247,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 218 |
).then(
|
| 219 |
disable_mds,
|
| 220 |
None,
|
| 221 |
-
|
| 222 |
).then(
|
| 223 |
disable_buttons_side_by_side,
|
| 224 |
None,
|
| 225 |
-
|
| 226 |
)
|
| 227 |
|
| 228 |
regenerate_btn.click(
|
| 229 |
reset_states_side_by_side_anony,
|
| 230 |
states,
|
| 231 |
-
states + model_selectors +
|
| 232 |
).then(
|
| 233 |
gen_func,
|
| 234 |
states + [imagebox] + model_selectors,
|
|
@@ -237,11 +266,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 237 |
).then(
|
| 238 |
enable_mds,
|
| 239 |
None,
|
| 240 |
-
|
| 241 |
).then(
|
| 242 |
enable_buttons_side_by_side,
|
| 243 |
None,
|
| 244 |
-
|
| 245 |
)
|
| 246 |
|
| 247 |
share_btn.click(
|
|
@@ -307,6 +336,19 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 307 |
normal_right = gr.Image(width=512, label = "Model B", show_download_button=True,)
|
| 308 |
rgb_right = gr.Image(width=512, label = "Model B", show_download_button=True,)
|
| 309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
with gr.Row(elem_id="Geometry Quality"):
|
| 311 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
| 312 |
geo_leftvote_btn = gr.Button(
|
|
@@ -333,8 +375,21 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 333 |
value="👎 Both are bad", visible=False, interactive=False
|
| 334 |
)
|
| 335 |
|
| 336 |
-
with gr.Row(elem_id="
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
align_leftvote_btn = gr.Button(
|
| 339 |
value="👈 A is better", visible=False, interactive=False
|
| 340 |
)
|
|
@@ -346,6 +401,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 346 |
value="👎 Both are bad", visible=False, interactive=False
|
| 347 |
)
|
| 348 |
|
|
|
|
| 349 |
with gr.Row():
|
| 350 |
imagebox = gr.Image(
|
| 351 |
width=512,
|
|
@@ -364,13 +420,18 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 364 |
|
| 365 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 366 |
|
| 367 |
-
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 368 |
-
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 369 |
-
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 370 |
states = [state_0, state_1]
|
| 371 |
model_selectors = [model_selector_left, model_selector_right]
|
| 372 |
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
model_selector_left.change(
|
| 375 |
clear_i2s_history_side_by_side,
|
| 376 |
None,
|
|
@@ -384,8 +445,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 384 |
api_name="model_selector_right"
|
| 385 |
)
|
| 386 |
|
| 387 |
-
for btn_list
|
| 388 |
-
[geo_md, text_md, align_md]):
|
| 389 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 390 |
|
| 391 |
leftvote_btn.click(
|
|
@@ -419,7 +479,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 419 |
imagebox.upload(
|
| 420 |
reset_states_side_by_side,
|
| 421 |
states,
|
| 422 |
-
states +
|
| 423 |
).then(
|
| 424 |
gen_func,
|
| 425 |
states + [imagebox] + model_selectors,
|
|
@@ -428,17 +488,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 428 |
).then(
|
| 429 |
enable_mds,
|
| 430 |
None,
|
| 431 |
-
|
| 432 |
).then(
|
| 433 |
enable_buttons_side_by_side,
|
| 434 |
None,
|
| 435 |
-
|
| 436 |
)
|
| 437 |
|
| 438 |
send_btn.click(
|
| 439 |
reset_states_side_by_side,
|
| 440 |
states,
|
| 441 |
-
states +
|
| 442 |
).then(
|
| 443 |
gen_func,
|
| 444 |
states + [imagebox] + model_selectors,
|
|
@@ -447,11 +507,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 447 |
).then(
|
| 448 |
enable_mds,
|
| 449 |
None,
|
| 450 |
-
|
| 451 |
).then(
|
| 452 |
enable_buttons_side_by_side,
|
| 453 |
None,
|
| 454 |
-
|
| 455 |
)
|
| 456 |
|
| 457 |
clear_btn.click(
|
|
@@ -462,17 +522,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 462 |
).then(
|
| 463 |
disable_mds,
|
| 464 |
None,
|
| 465 |
-
|
| 466 |
).then(
|
| 467 |
disable_buttons_side_by_side,
|
| 468 |
None,
|
| 469 |
-
|
| 470 |
)
|
| 471 |
|
| 472 |
regenerate_btn.click(
|
| 473 |
reset_states_side_by_side,
|
| 474 |
states,
|
| 475 |
-
states +
|
| 476 |
).then(
|
| 477 |
gen_func,
|
| 478 |
states + [imagebox] + model_selectors,
|
|
@@ -481,11 +541,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 481 |
).then(
|
| 482 |
enable_mds,
|
| 483 |
None,
|
| 484 |
-
|
| 485 |
).then(
|
| 486 |
enable_buttons_side_by_side,
|
| 487 |
None,
|
| 488 |
-
|
| 489 |
)
|
| 490 |
|
| 491 |
share_btn.click(
|
|
@@ -526,6 +586,12 @@ def build_i2s_ui_single_model(models):
|
|
| 526 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
| 527 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
| 528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
with gr.Row(elem_id="Geometry Quality"):
|
| 530 |
geo_md = gr.Markdown("Geometry Quality: ")
|
| 531 |
geo_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
|
@@ -538,12 +604,19 @@ def build_i2s_ui_single_model(models):
|
|
| 538 |
text_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 539 |
text_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 540 |
|
| 541 |
-
with gr.Row(elem_id="
|
| 542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
align_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 544 |
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 545 |
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 546 |
|
|
|
|
| 547 |
with gr.Row():
|
| 548 |
imagebox = gr.Image(
|
| 549 |
width=512,
|
|
@@ -565,9 +638,12 @@ def build_i2s_ui_single_model(models):
|
|
| 565 |
geo_btn_list = [geo_upvote_btn, geo_downvote_btn, geo_flag_btn]
|
| 566 |
text_btn_list = [text_upvote_btn, text_downvote_btn, text_flag_btn]
|
| 567 |
align_btn_list = [align_upvote_btn, align_downvote_btn, align_flag_btn]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
|
| 569 |
-
for
|
| 570 |
-
[geo_md, text_md, align_md]):
|
| 571 |
upvote_btn, downvote_btn, flag_btn = btn_list
|
| 572 |
|
| 573 |
upvote_btn.click(
|
|
@@ -597,7 +673,7 @@ def build_i2s_ui_single_model(models):
|
|
| 597 |
imagebox.upload(
|
| 598 |
reset_state,
|
| 599 |
state,
|
| 600 |
-
[state] +
|
| 601 |
).then(
|
| 602 |
gen_func,
|
| 603 |
[state, imagebox, model_selector],
|
|
@@ -607,13 +683,13 @@ def build_i2s_ui_single_model(models):
|
|
| 607 |
).then(
|
| 608 |
enable_buttons,
|
| 609 |
None,
|
| 610 |
-
|
| 611 |
)
|
| 612 |
|
| 613 |
send_btn.click(
|
| 614 |
reset_state,
|
| 615 |
state,
|
| 616 |
-
[state] +
|
| 617 |
).then(
|
| 618 |
gen_func,
|
| 619 |
[state, imagebox, model_selector],
|
|
@@ -623,7 +699,7 @@ def build_i2s_ui_single_model(models):
|
|
| 623 |
).then(
|
| 624 |
enable_buttons,
|
| 625 |
None,
|
| 626 |
-
|
| 627 |
)
|
| 628 |
|
| 629 |
clear_btn.click(
|
|
@@ -635,13 +711,13 @@ def build_i2s_ui_single_model(models):
|
|
| 635 |
).then(
|
| 636 |
disable_buttons,
|
| 637 |
None,
|
| 638 |
-
|
| 639 |
)
|
| 640 |
|
| 641 |
regenerate_btn.click(
|
| 642 |
reset_state,
|
| 643 |
state,
|
| 644 |
-
[state] +
|
| 645 |
).then(
|
| 646 |
gen_func,
|
| 647 |
[state, imagebox, model_selector],
|
|
@@ -651,6 +727,6 @@ def build_i2s_ui_single_model(models):
|
|
| 651 |
).then(
|
| 652 |
enable_buttons,
|
| 653 |
None,
|
| 654 |
-
|
| 655 |
)
|
| 656 |
|
|
|
|
| 74 |
with gr.Column():
|
| 75 |
model_selector_right = gr.Markdown("", visible=False)
|
| 76 |
with gr.Row():
|
| 77 |
+
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
| 78 |
+
|
| 79 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
| 80 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
| 81 |
+
plausive_leftvote_btn = gr.Button(
|
| 82 |
+
value="👈 A is better", visible=False, interactive=False
|
| 83 |
+
)
|
| 84 |
+
plausive_rightvote_btn = gr.Button(
|
| 85 |
+
value="👉 B is better", visible=False, interactive=False
|
| 86 |
+
)
|
| 87 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 88 |
+
plausive_bothbad_btn = gr.Button(
|
| 89 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 90 |
+
)
|
| 91 |
|
| 92 |
with gr.Row(elem_id="Geometry Quality"):
|
| 93 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
|
|
|
| 115 |
value="👎 Both are bad", visible=False, interactive=False
|
| 116 |
)
|
| 117 |
|
| 118 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
| 119 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
| 120 |
+
coherence_leftvote_btn = gr.Button(
|
| 121 |
+
value="👈 A is better", visible=False, interactive=False
|
| 122 |
+
)
|
| 123 |
+
coherence_rightvote_btn = gr.Button(
|
| 124 |
+
value="👉 B is better", visible=False, interactive=False
|
| 125 |
+
)
|
| 126 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 127 |
+
coherence_bothbad_btn = gr.Button(
|
| 128 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
with gr.Row(elem_id="Visual Alignment"):
|
| 132 |
+
align_md = gr.Markdown("Visual Alignment: ", visible=False, elem_id="evaldim_markdown")
|
| 133 |
align_leftvote_btn = gr.Button(
|
| 134 |
value="👈 A is better", visible=False, interactive=False
|
| 135 |
)
|
|
|
|
| 158 |
|
| 159 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 160 |
|
| 161 |
+
states = [state_0, state_1]
|
| 162 |
+
model_selectors = [model_selector_left, model_selector_right]
|
| 163 |
+
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 164 |
|
| 165 |
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 166 |
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 167 |
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 168 |
+
plausive_btn_list = [plausive_leftvote_btn, plausive_rightvote_btn, plausive_tie_btn, plausive_bothbad_btn]
|
| 169 |
+
coherence_btn_list = [coherence_leftvote_btn, coherence_rightvote_btn, coherence_tie_btn, coherence_bothbad_btn]
|
| 170 |
+
dim_md_list = [geo_md, text_md, align_md, plausive_md, coherence_md]
|
| 171 |
+
vote_btn_list = geo_btn_list + text_btn_list + align_btn_list + plausive_btn_list + coherence_btn_list
|
| 172 |
|
| 173 |
+
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
|
| 174 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 175 |
|
| 176 |
leftvote_btn.click(
|
|
|
|
| 204 |
imagebox.upload(
|
| 205 |
reset_states_side_by_side_anony,
|
| 206 |
states,
|
| 207 |
+
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 208 |
).then(
|
| 209 |
gen_func,
|
| 210 |
states + [imagebox] + model_selectors,
|
|
|
|
| 213 |
).then(
|
| 214 |
enable_mds,
|
| 215 |
None,
|
| 216 |
+
dim_md_list
|
| 217 |
).then(
|
| 218 |
enable_buttons_side_by_side,
|
| 219 |
None,
|
| 220 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 221 |
)
|
| 222 |
|
| 223 |
send_btn.click(
|
| 224 |
reset_states_side_by_side_anony,
|
| 225 |
states,
|
| 226 |
+
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 227 |
).then(
|
| 228 |
gen_func,
|
| 229 |
states + [imagebox] + model_selectors,
|
|
|
|
| 232 |
).then(
|
| 233 |
enable_mds,
|
| 234 |
None,
|
| 235 |
+
dim_md_list
|
| 236 |
).then(
|
| 237 |
enable_buttons_side_by_side,
|
| 238 |
None,
|
| 239 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 240 |
)
|
| 241 |
|
| 242 |
clear_btn.click(
|
|
|
|
| 247 |
).then(
|
| 248 |
disable_mds,
|
| 249 |
None,
|
| 250 |
+
dim_md_list
|
| 251 |
).then(
|
| 252 |
disable_buttons_side_by_side,
|
| 253 |
None,
|
| 254 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 255 |
)
|
| 256 |
|
| 257 |
regenerate_btn.click(
|
| 258 |
reset_states_side_by_side_anony,
|
| 259 |
states,
|
| 260 |
+
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 261 |
).then(
|
| 262 |
gen_func,
|
| 263 |
states + [imagebox] + model_selectors,
|
|
|
|
| 266 |
).then(
|
| 267 |
enable_mds,
|
| 268 |
None,
|
| 269 |
+
dim_md_list
|
| 270 |
).then(
|
| 271 |
enable_buttons_side_by_side,
|
| 272 |
None,
|
| 273 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 274 |
)
|
| 275 |
|
| 276 |
share_btn.click(
|
|
|
|
| 336 |
normal_right = gr.Image(width=512, label = "Model B", show_download_button=True,)
|
| 337 |
rgb_right = gr.Image(width=512, label = "Model B", show_download_button=True,)
|
| 338 |
|
| 339 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
| 340 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
| 341 |
+
plausive_leftvote_btn = gr.Button(
|
| 342 |
+
value="👈 A is better", visible=False, interactive=False
|
| 343 |
+
)
|
| 344 |
+
plausive_rightvote_btn = gr.Button(
|
| 345 |
+
value="👉 B is better", visible=False, interactive=False
|
| 346 |
+
)
|
| 347 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 348 |
+
plausive_bothbad_btn = gr.Button(
|
| 349 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 350 |
+
)
|
| 351 |
+
|
| 352 |
with gr.Row(elem_id="Geometry Quality"):
|
| 353 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
| 354 |
geo_leftvote_btn = gr.Button(
|
|
|
|
| 375 |
value="👎 Both are bad", visible=False, interactive=False
|
| 376 |
)
|
| 377 |
|
| 378 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
| 379 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
| 380 |
+
coherence_leftvote_btn = gr.Button(
|
| 381 |
+
value="👈 A is better", visible=False, interactive=False
|
| 382 |
+
)
|
| 383 |
+
coherence_rightvote_btn = gr.Button(
|
| 384 |
+
value="👉 B is better", visible=False, interactive=False
|
| 385 |
+
)
|
| 386 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 387 |
+
coherence_bothbad_btn = gr.Button(
|
| 388 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 389 |
+
)
|
| 390 |
+
|
| 391 |
+
with gr.Row(elem_id="Visual Alignment"):
|
| 392 |
+
align_md = gr.Markdown("Visual Alignment: ", visible=False, elem_id="evaldim_markdown")
|
| 393 |
align_leftvote_btn = gr.Button(
|
| 394 |
value="👈 A is better", visible=False, interactive=False
|
| 395 |
)
|
|
|
|
| 401 |
value="👎 Both are bad", visible=False, interactive=False
|
| 402 |
)
|
| 403 |
|
| 404 |
+
|
| 405 |
with gr.Row():
|
| 406 |
imagebox = gr.Image(
|
| 407 |
width=512,
|
|
|
|
| 420 |
|
| 421 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 422 |
|
|
|
|
|
|
|
|
|
|
| 423 |
states = [state_0, state_1]
|
| 424 |
model_selectors = [model_selector_left, model_selector_right]
|
| 425 |
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 426 |
|
| 427 |
+
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 428 |
+
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 429 |
+
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 430 |
+
plausive_btn_list = [plausive_leftvote_btn, plausive_rightvote_btn, plausive_tie_btn, plausive_bothbad_btn]
|
| 431 |
+
coherence_btn_list = [coherence_leftvote_btn, coherence_rightvote_btn, coherence_tie_btn, coherence_bothbad_btn]
|
| 432 |
+
dim_md_list = [geo_md, text_md, align_md, plausive_md, coherence_md]
|
| 433 |
+
vote_btn_list = geo_btn_list + text_btn_list + align_btn_list + plausive_btn_list + coherence_btn_list
|
| 434 |
+
|
| 435 |
model_selector_left.change(
|
| 436 |
clear_i2s_history_side_by_side,
|
| 437 |
None,
|
|
|
|
| 445 |
api_name="model_selector_right"
|
| 446 |
)
|
| 447 |
|
| 448 |
+
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
|
| 449 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 450 |
|
| 451 |
leftvote_btn.click(
|
|
|
|
| 479 |
imagebox.upload(
|
| 480 |
reset_states_side_by_side,
|
| 481 |
states,
|
| 482 |
+
states + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 483 |
).then(
|
| 484 |
gen_func,
|
| 485 |
states + [imagebox] + model_selectors,
|
|
|
|
| 488 |
).then(
|
| 489 |
enable_mds,
|
| 490 |
None,
|
| 491 |
+
dim_md_list
|
| 492 |
).then(
|
| 493 |
enable_buttons_side_by_side,
|
| 494 |
None,
|
| 495 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 496 |
)
|
| 497 |
|
| 498 |
send_btn.click(
|
| 499 |
reset_states_side_by_side,
|
| 500 |
states,
|
| 501 |
+
states + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 502 |
).then(
|
| 503 |
gen_func,
|
| 504 |
states + [imagebox] + model_selectors,
|
|
|
|
| 507 |
).then(
|
| 508 |
enable_mds,
|
| 509 |
None,
|
| 510 |
+
dim_md_list
|
| 511 |
).then(
|
| 512 |
enable_buttons_side_by_side,
|
| 513 |
None,
|
| 514 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 515 |
)
|
| 516 |
|
| 517 |
clear_btn.click(
|
|
|
|
| 522 |
).then(
|
| 523 |
disable_mds,
|
| 524 |
None,
|
| 525 |
+
dim_md_list
|
| 526 |
).then(
|
| 527 |
disable_buttons_side_by_side,
|
| 528 |
None,
|
| 529 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 530 |
)
|
| 531 |
|
| 532 |
regenerate_btn.click(
|
| 533 |
reset_states_side_by_side,
|
| 534 |
states,
|
| 535 |
+
states + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 536 |
).then(
|
| 537 |
gen_func,
|
| 538 |
states + [imagebox] + model_selectors,
|
|
|
|
| 541 |
).then(
|
| 542 |
enable_mds,
|
| 543 |
None,
|
| 544 |
+
dim_md_list
|
| 545 |
).then(
|
| 546 |
enable_buttons_side_by_side,
|
| 547 |
None,
|
| 548 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 549 |
)
|
| 550 |
|
| 551 |
share_btn.click(
|
|
|
|
| 586 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
| 587 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
| 588 |
|
| 589 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
| 590 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", elem_id="evaldim_markdown")
|
| 591 |
+
plausive_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 592 |
+
plausive_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 593 |
+
plausive_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 594 |
+
|
| 595 |
with gr.Row(elem_id="Geometry Quality"):
|
| 596 |
geo_md = gr.Markdown("Geometry Quality: ")
|
| 597 |
geo_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
|
|
|
| 604 |
text_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 605 |
text_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 606 |
|
| 607 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
| 608 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", elem_id="evaldim_markdown")
|
| 609 |
+
coherence_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 610 |
+
coherence_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 611 |
+
coherence_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 612 |
+
|
| 613 |
+
with gr.Row(elem_id="Visual Alignment"):
|
| 614 |
+
align_md = gr.Markdown("Visual Alignment: ", elem_id="evaldim_markdown")
|
| 615 |
align_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 616 |
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 617 |
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 618 |
|
| 619 |
+
|
| 620 |
with gr.Row():
|
| 621 |
imagebox = gr.Image(
|
| 622 |
width=512,
|
|
|
|
| 638 |
geo_btn_list = [geo_upvote_btn, geo_downvote_btn, geo_flag_btn]
|
| 639 |
text_btn_list = [text_upvote_btn, text_downvote_btn, text_flag_btn]
|
| 640 |
align_btn_list = [align_upvote_btn, align_downvote_btn, align_flag_btn]
|
| 641 |
+
plausive_btn_list = [plausive_upvote_btn, plausive_downvote_btn, plausive_flag_btn]
|
| 642 |
+
coherence_btn_list = [coherence_upvote_btn, coherence_downvote_btn, coherence_flag_btn]
|
| 643 |
+
dim_md_list = [geo_md, text_md, align_md, plausive_md, coherence_md]
|
| 644 |
+
vote_btn_list = geo_btn_list + text_btn_list + align_btn_list + plausive_btn_list + coherence_btn_list
|
| 645 |
|
| 646 |
+
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
|
| 647 |
upvote_btn, downvote_btn, flag_btn = btn_list
|
| 648 |
|
| 649 |
upvote_btn.click(
|
|
|
|
| 673 |
imagebox.upload(
|
| 674 |
reset_state,
|
| 675 |
state,
|
| 676 |
+
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
| 677 |
).then(
|
| 678 |
gen_func,
|
| 679 |
[state, imagebox, model_selector],
|
|
|
|
| 683 |
).then(
|
| 684 |
enable_buttons,
|
| 685 |
None,
|
| 686 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 687 |
)
|
| 688 |
|
| 689 |
send_btn.click(
|
| 690 |
reset_state,
|
| 691 |
state,
|
| 692 |
+
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
| 693 |
).then(
|
| 694 |
gen_func,
|
| 695 |
[state, imagebox, model_selector],
|
|
|
|
| 699 |
).then(
|
| 700 |
enable_buttons,
|
| 701 |
None,
|
| 702 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 703 |
)
|
| 704 |
|
| 705 |
clear_btn.click(
|
|
|
|
| 711 |
).then(
|
| 712 |
disable_buttons,
|
| 713 |
None,
|
| 714 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 715 |
)
|
| 716 |
|
| 717 |
regenerate_btn.click(
|
| 718 |
reset_state,
|
| 719 |
state,
|
| 720 |
+
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
| 721 |
).then(
|
| 722 |
gen_func,
|
| 723 |
[state, imagebox, model_selector],
|
|
|
|
| 727 |
).then(
|
| 728 |
enable_buttons,
|
| 729 |
None,
|
| 730 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 731 |
)
|
| 732 |
|
serve/gradio_web_t2s.py
CHANGED
|
@@ -72,6 +72,19 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 72 |
with gr.Row():
|
| 73 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
with gr.Row(elem_id="Geometry Quality"):
|
| 76 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
| 77 |
geo_leftvote_btn = gr.Button(
|
|
@@ -98,8 +111,21 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 98 |
value="👎 Both are bad", visible=False, interactive=False
|
| 99 |
)
|
| 100 |
|
| 101 |
-
with gr.Row(elem_id="
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
align_leftvote_btn = gr.Button(
|
| 104 |
value="👈 A is better", visible=False, interactive=False
|
| 105 |
)
|
|
@@ -128,15 +154,19 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 128 |
|
| 129 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 130 |
|
| 131 |
-
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 132 |
-
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 133 |
-
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 134 |
states = [state_0, state_1]
|
| 135 |
model_selectors = [model_selector_left, model_selector_right]
|
| 136 |
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 141 |
|
| 142 |
leftvote_btn.click(
|
|
@@ -170,7 +200,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 170 |
textbox.submit(
|
| 171 |
reset_states_side_by_side_anony,
|
| 172 |
states,
|
| 173 |
-
states + model_selectors +
|
| 174 |
).then(
|
| 175 |
gen_func,
|
| 176 |
states + [textbox] + model_selectors,
|
|
@@ -179,17 +209,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 179 |
).then(
|
| 180 |
enable_mds,
|
| 181 |
None,
|
| 182 |
-
|
| 183 |
).then(
|
| 184 |
enable_buttons_side_by_side,
|
| 185 |
None,
|
| 186 |
-
|
| 187 |
)
|
| 188 |
|
| 189 |
send_btn.click(
|
| 190 |
reset_states_side_by_side_anony,
|
| 191 |
states,
|
| 192 |
-
states + model_selectors +
|
| 193 |
).then(
|
| 194 |
gen_func,
|
| 195 |
states + [textbox] + model_selectors,
|
|
@@ -198,11 +228,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 198 |
).then(
|
| 199 |
enable_mds,
|
| 200 |
None,
|
| 201 |
-
|
| 202 |
).then(
|
| 203 |
enable_buttons_side_by_side,
|
| 204 |
None,
|
| 205 |
-
|
| 206 |
)
|
| 207 |
|
| 208 |
clear_btn.click(
|
|
@@ -213,17 +243,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 213 |
).then(
|
| 214 |
disable_mds,
|
| 215 |
None,
|
| 216 |
-
|
| 217 |
).then(
|
| 218 |
disable_buttons_side_by_side,
|
| 219 |
None,
|
| 220 |
-
|
| 221 |
)
|
| 222 |
|
| 223 |
regenerate_btn.click(
|
| 224 |
reset_states_side_by_side_anony,
|
| 225 |
states,
|
| 226 |
-
states + model_selectors +
|
| 227 |
).then(
|
| 228 |
gen_func,
|
| 229 |
states + [textbox] + model_selectors,
|
|
@@ -232,11 +262,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 232 |
).then(
|
| 233 |
enable_mds,
|
| 234 |
None,
|
| 235 |
-
|
| 236 |
).then(
|
| 237 |
enable_buttons_side_by_side,
|
| 238 |
None,
|
| 239 |
-
|
| 240 |
)
|
| 241 |
|
| 242 |
share_btn.click(
|
|
@@ -304,6 +334,19 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 304 |
with gr.Row():
|
| 305 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
with gr.Row(elem_id="Geometry Quality"):
|
| 308 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
| 309 |
geo_leftvote_btn = gr.Button(
|
|
@@ -330,8 +373,21 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 330 |
value="👎 Both are bad", visible=False, interactive=False
|
| 331 |
)
|
| 332 |
|
| 333 |
-
with gr.Row(elem_id="
|
| 334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
align_leftvote_btn = gr.Button(
|
| 336 |
value="👈 A is better", visible=False, interactive=False
|
| 337 |
)
|
|
@@ -360,13 +416,18 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 360 |
|
| 361 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 362 |
|
| 363 |
-
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 364 |
-
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 365 |
-
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 366 |
states = [state_0, state_1]
|
| 367 |
model_selectors = [model_selector_left, model_selector_right]
|
| 368 |
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
model_selector_left.change(
|
| 371 |
clear_t2s_history_side_by_side,
|
| 372 |
None,
|
|
@@ -380,8 +441,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 380 |
api_name="model_selector_right"
|
| 381 |
)
|
| 382 |
|
| 383 |
-
for
|
| 384 |
-
[geo_md, text_md, align_md]):
|
| 385 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 386 |
|
| 387 |
leftvote_btn.click(
|
|
@@ -415,7 +475,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 415 |
textbox.submit(
|
| 416 |
reset_states_side_by_side,
|
| 417 |
states,
|
| 418 |
-
states +
|
| 419 |
).then(
|
| 420 |
gen_func,
|
| 421 |
states + [textbox] + model_selectors,
|
|
@@ -424,17 +484,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 424 |
).then(
|
| 425 |
enable_mds,
|
| 426 |
None,
|
| 427 |
-
|
| 428 |
).then(
|
| 429 |
enable_buttons_side_by_side,
|
| 430 |
None,
|
| 431 |
-
|
| 432 |
)
|
| 433 |
|
| 434 |
send_btn.click(
|
| 435 |
reset_states_side_by_side,
|
| 436 |
states,
|
| 437 |
-
states +
|
| 438 |
).then(
|
| 439 |
gen_func,
|
| 440 |
states + [textbox] + model_selectors,
|
|
@@ -443,11 +503,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 443 |
).then(
|
| 444 |
enable_mds,
|
| 445 |
None,
|
| 446 |
-
|
| 447 |
).then(
|
| 448 |
enable_buttons_side_by_side,
|
| 449 |
None,
|
| 450 |
-
|
| 451 |
)
|
| 452 |
|
| 453 |
clear_btn.click(
|
|
@@ -458,17 +518,17 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 458 |
).then(
|
| 459 |
disable_mds,
|
| 460 |
None,
|
| 461 |
-
|
| 462 |
).then(
|
| 463 |
disable_buttons_side_by_side,
|
| 464 |
None,
|
| 465 |
-
|
| 466 |
)
|
| 467 |
|
| 468 |
regenerate_btn.click(
|
| 469 |
reset_states_side_by_side,
|
| 470 |
states,
|
| 471 |
-
states +
|
| 472 |
).then(
|
| 473 |
gen_func,
|
| 474 |
states + [textbox] + model_selectors,
|
|
@@ -477,11 +537,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
| 477 |
).then(
|
| 478 |
enable_mds,
|
| 479 |
None,
|
| 480 |
-
|
| 481 |
).then(
|
| 482 |
enable_buttons_side_by_side,
|
| 483 |
None,
|
| 484 |
-
|
| 485 |
)
|
| 486 |
|
| 487 |
share_btn.click(
|
|
@@ -522,21 +582,32 @@ def build_t2s_ui_single_model(models):
|
|
| 522 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
| 523 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
| 524 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
with gr.Row(elem_id="Geometry Quality"):
|
| 526 |
geo_md = gr.Markdown("Geometry Quality: ", elem_id="evaldim_markdown")
|
| 527 |
geo_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 528 |
geo_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 529 |
geo_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 530 |
|
| 531 |
-
|
| 532 |
with gr.Row(elem_id="Texture Quality"):
|
| 533 |
text_md = gr.Markdown("Texture Quality: ", elem_id="evaldim_markdown")
|
| 534 |
text_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 535 |
text_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 536 |
text_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 537 |
-
|
| 538 |
-
with gr.Row(elem_id="
|
| 539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 540 |
align_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 541 |
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 542 |
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
|
@@ -561,9 +632,12 @@ def build_t2s_ui_single_model(models):
|
|
| 561 |
geo_btn_list = [geo_upvote_btn, geo_downvote_btn, geo_flag_btn]
|
| 562 |
text_btn_list = [text_upvote_btn, text_downvote_btn, text_flag_btn]
|
| 563 |
align_btn_list = [align_upvote_btn, align_downvote_btn, align_flag_btn]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 564 |
|
| 565 |
-
for
|
| 566 |
-
[geo_md, text_md, align_md]):
|
| 567 |
upvote_btn, downvote_btn, flag_btn = btn_list
|
| 568 |
|
| 569 |
upvote_btn.click(
|
|
@@ -593,7 +667,7 @@ def build_t2s_ui_single_model(models):
|
|
| 593 |
textbox.submit(
|
| 594 |
reset_state,
|
| 595 |
state,
|
| 596 |
-
[state] +
|
| 597 |
).then(
|
| 598 |
gen_func,
|
| 599 |
[state, textbox, model_selector],
|
|
@@ -603,13 +677,13 @@ def build_t2s_ui_single_model(models):
|
|
| 603 |
).then(
|
| 604 |
enable_buttons,
|
| 605 |
None,
|
| 606 |
-
|
| 607 |
)
|
| 608 |
|
| 609 |
send_btn.click(
|
| 610 |
reset_state,
|
| 611 |
state,
|
| 612 |
-
[state] +
|
| 613 |
).then(
|
| 614 |
gen_func,
|
| 615 |
[state, textbox, model_selector],
|
|
@@ -619,7 +693,7 @@ def build_t2s_ui_single_model(models):
|
|
| 619 |
).then(
|
| 620 |
enable_buttons,
|
| 621 |
None,
|
| 622 |
-
|
| 623 |
)
|
| 624 |
|
| 625 |
clear_btn.click(
|
|
@@ -631,13 +705,13 @@ def build_t2s_ui_single_model(models):
|
|
| 631 |
).then(
|
| 632 |
disable_buttons,
|
| 633 |
None,
|
| 634 |
-
|
| 635 |
)
|
| 636 |
|
| 637 |
regenerate_btn.click(
|
| 638 |
reset_state,
|
| 639 |
state,
|
| 640 |
-
[state] +
|
| 641 |
).then(
|
| 642 |
gen_func,
|
| 643 |
[state, textbox, model_selector],
|
|
@@ -647,6 +721,6 @@ def build_t2s_ui_single_model(models):
|
|
| 647 |
).then(
|
| 648 |
enable_buttons,
|
| 649 |
None,
|
| 650 |
-
|
| 651 |
)
|
| 652 |
|
|
|
|
| 72 |
with gr.Row():
|
| 73 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
| 74 |
|
| 75 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
| 76 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
| 77 |
+
plausive_leftvote_btn = gr.Button(
|
| 78 |
+
value="👈 A is better", visible=False, interactive=False
|
| 79 |
+
)
|
| 80 |
+
plausive_rightvote_btn = gr.Button(
|
| 81 |
+
value="👉 B is better", visible=False, interactive=False
|
| 82 |
+
)
|
| 83 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 84 |
+
plausive_bothbad_btn = gr.Button(
|
| 85 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
with gr.Row(elem_id="Geometry Quality"):
|
| 89 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
| 90 |
geo_leftvote_btn = gr.Button(
|
|
|
|
| 111 |
value="👎 Both are bad", visible=False, interactive=False
|
| 112 |
)
|
| 113 |
|
| 114 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
| 115 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
| 116 |
+
coherence_leftvote_btn = gr.Button(
|
| 117 |
+
value="👈 A is better", visible=False, interactive=False
|
| 118 |
+
)
|
| 119 |
+
coherence_rightvote_btn = gr.Button(
|
| 120 |
+
value="👉 B is better", visible=False, interactive=False
|
| 121 |
+
)
|
| 122 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 123 |
+
coherence_bothbad_btn = gr.Button(
|
| 124 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
with gr.Row(elem_id="Semantic Alignment"):
|
| 128 |
+
align_md = gr.Markdown("Semantic Alignment: ", visible=False, elem_id="evaldim_markdown")
|
| 129 |
align_leftvote_btn = gr.Button(
|
| 130 |
value="👈 A is better", visible=False, interactive=False
|
| 131 |
)
|
|
|
|
| 154 |
|
| 155 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 156 |
|
|
|
|
|
|
|
|
|
|
| 157 |
states = [state_0, state_1]
|
| 158 |
model_selectors = [model_selector_left, model_selector_right]
|
| 159 |
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 160 |
|
| 161 |
+
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 162 |
+
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 163 |
+
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 164 |
+
plausive_btn_list = [plausive_leftvote_btn, plausive_rightvote_btn, plausive_tie_btn, plausive_bothbad_btn]
|
| 165 |
+
coherence_btn_list = [coherence_leftvote_btn, coherence_rightvote_btn, coherence_tie_btn, coherence_bothbad_btn]
|
| 166 |
+
dim_md_list = [geo_md, text_md, align_md, plausive_md, coherence_md]
|
| 167 |
+
vote_btn_list = geo_btn_list + text_btn_list + align_btn_list + plausive_btn_list + coherence_btn_list
|
| 168 |
+
|
| 169 |
+
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
| 170 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 171 |
|
| 172 |
leftvote_btn.click(
|
|
|
|
| 200 |
textbox.submit(
|
| 201 |
reset_states_side_by_side_anony,
|
| 202 |
states,
|
| 203 |
+
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 204 |
).then(
|
| 205 |
gen_func,
|
| 206 |
states + [textbox] + model_selectors,
|
|
|
|
| 209 |
).then(
|
| 210 |
enable_mds,
|
| 211 |
None,
|
| 212 |
+
dim_md_list
|
| 213 |
).then(
|
| 214 |
enable_buttons_side_by_side,
|
| 215 |
None,
|
| 216 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 217 |
)
|
| 218 |
|
| 219 |
send_btn.click(
|
| 220 |
reset_states_side_by_side_anony,
|
| 221 |
states,
|
| 222 |
+
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 223 |
).then(
|
| 224 |
gen_func,
|
| 225 |
states + [textbox] + model_selectors,
|
|
|
|
| 228 |
).then(
|
| 229 |
enable_mds,
|
| 230 |
None,
|
| 231 |
+
dim_md_list
|
| 232 |
).then(
|
| 233 |
enable_buttons_side_by_side,
|
| 234 |
None,
|
| 235 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 236 |
)
|
| 237 |
|
| 238 |
clear_btn.click(
|
|
|
|
| 243 |
).then(
|
| 244 |
disable_mds,
|
| 245 |
None,
|
| 246 |
+
dim_md_list
|
| 247 |
).then(
|
| 248 |
disable_buttons_side_by_side,
|
| 249 |
None,
|
| 250 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 251 |
)
|
| 252 |
|
| 253 |
regenerate_btn.click(
|
| 254 |
reset_states_side_by_side_anony,
|
| 255 |
states,
|
| 256 |
+
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
| 257 |
).then(
|
| 258 |
gen_func,
|
| 259 |
states + [textbox] + model_selectors,
|
|
|
|
| 262 |
).then(
|
| 263 |
enable_mds,
|
| 264 |
None,
|
| 265 |
+
dim_md_list
|
| 266 |
).then(
|
| 267 |
enable_buttons_side_by_side,
|
| 268 |
None,
|
| 269 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 270 |
)
|
| 271 |
|
| 272 |
share_btn.click(
|
|
|
|
| 334 |
with gr.Row():
|
| 335 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
| 336 |
|
| 337 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
| 338 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
| 339 |
+
plausive_leftvote_btn = gr.Button(
|
| 340 |
+
value="👈 A is better", visible=False, interactive=False
|
| 341 |
+
)
|
| 342 |
+
plausive_rightvote_btn = gr.Button(
|
| 343 |
+
value="👉 B is better", visible=False, interactive=False
|
| 344 |
+
)
|
| 345 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 346 |
+
plausive_bothbad_btn = gr.Button(
|
| 347 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
with gr.Row(elem_id="Geometry Quality"):
|
| 351 |
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
| 352 |
geo_leftvote_btn = gr.Button(
|
|
|
|
| 373 |
value="👎 Both are bad", visible=False, interactive=False
|
| 374 |
)
|
| 375 |
|
| 376 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
| 377 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
| 378 |
+
coherence_leftvote_btn = gr.Button(
|
| 379 |
+
value="👈 A is better", visible=False, interactive=False
|
| 380 |
+
)
|
| 381 |
+
coherence_rightvote_btn = gr.Button(
|
| 382 |
+
value="👉 B is better", visible=False, interactive=False
|
| 383 |
+
)
|
| 384 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
| 385 |
+
coherence_bothbad_btn = gr.Button(
|
| 386 |
+
value="👎 Both are bad", visible=False, interactive=False
|
| 387 |
+
)
|
| 388 |
+
|
| 389 |
+
with gr.Row(elem_id="Semantic Alignment"):
|
| 390 |
+
align_md = gr.Markdown("Semantic Alignment: ", visible=False, elem_id="evaldim_markdown")
|
| 391 |
align_leftvote_btn = gr.Button(
|
| 392 |
value="👈 A is better", visible=False, interactive=False
|
| 393 |
)
|
|
|
|
| 416 |
|
| 417 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
| 418 |
|
|
|
|
|
|
|
|
|
|
| 419 |
states = [state_0, state_1]
|
| 420 |
model_selectors = [model_selector_left, model_selector_right]
|
| 421 |
results = [normal_left, rgb_left, normal_right, rgb_right]
|
| 422 |
|
| 423 |
+
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
| 424 |
+
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
| 425 |
+
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
| 426 |
+
plausive_btn_list = [plausive_leftvote_btn, plausive_rightvote_btn, plausive_tie_btn, plausive_bothbad_btn]
|
| 427 |
+
coherence_btn_list = [coherence_leftvote_btn, coherence_rightvote_btn, coherence_tie_btn, coherence_bothbad_btn]
|
| 428 |
+
dim_md_list = [geo_md, text_md, align_md, plausive_md, coherence_md]
|
| 429 |
+
vote_btn_list = geo_btn_list + text_btn_list + align_btn_list + plausive_btn_list + coherence_btn_list
|
| 430 |
+
|
| 431 |
model_selector_left.change(
|
| 432 |
clear_t2s_history_side_by_side,
|
| 433 |
None,
|
|
|
|
| 441 |
api_name="model_selector_right"
|
| 442 |
)
|
| 443 |
|
| 444 |
+
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
|
| 445 |
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
| 446 |
|
| 447 |
leftvote_btn.click(
|
|
|
|
| 475 |
textbox.submit(
|
| 476 |
reset_states_side_by_side,
|
| 477 |
states,
|
| 478 |
+
states + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 479 |
).then(
|
| 480 |
gen_func,
|
| 481 |
states + [textbox] + model_selectors,
|
|
|
|
| 484 |
).then(
|
| 485 |
enable_mds,
|
| 486 |
None,
|
| 487 |
+
dim_md_list
|
| 488 |
).then(
|
| 489 |
enable_buttons_side_by_side,
|
| 490 |
None,
|
| 491 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 492 |
)
|
| 493 |
|
| 494 |
send_btn.click(
|
| 495 |
reset_states_side_by_side,
|
| 496 |
states,
|
| 497 |
+
states + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
| 498 |
).then(
|
| 499 |
gen_func,
|
| 500 |
states + [textbox] + model_selectors,
|
|
|
|
| 503 |
).then(
|
| 504 |
enable_mds,
|
| 505 |
None,
|
| 506 |
+
dim_md_list
|
| 507 |
).then(
|
| 508 |
enable_buttons_side_by_side,
|
| 509 |
None,
|
| 510 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 511 |
)
|
| 512 |
|
| 513 |
clear_btn.click(
|
|
|
|
| 518 |
).then(
|
| 519 |
disable_mds,
|
| 520 |
None,
|
| 521 |
+
dim_md_list
|
| 522 |
).then(
|
| 523 |
disable_buttons_side_by_side,
|
| 524 |
None,
|
| 525 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 526 |
)
|
| 527 |
|
| 528 |
regenerate_btn.click(
|
| 529 |
reset_states_side_by_side,
|
| 530 |
states,
|
| 531 |
+
states + vote_btn_list + [regenerate_btn, clear_btn, geo_md, text_md, align_md]
|
| 532 |
).then(
|
| 533 |
gen_func,
|
| 534 |
states + [textbox] + model_selectors,
|
|
|
|
| 537 |
).then(
|
| 538 |
enable_mds,
|
| 539 |
None,
|
| 540 |
+
dim_md_list
|
| 541 |
).then(
|
| 542 |
enable_buttons_side_by_side,
|
| 543 |
None,
|
| 544 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 545 |
)
|
| 546 |
|
| 547 |
share_btn.click(
|
|
|
|
| 582 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
| 583 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
| 584 |
|
| 585 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
| 586 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", elem_id="evaldim_markdown")
|
| 587 |
+
plausive_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 588 |
+
plausive_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 589 |
+
plausive_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 590 |
+
|
| 591 |
with gr.Row(elem_id="Geometry Quality"):
|
| 592 |
geo_md = gr.Markdown("Geometry Quality: ", elem_id="evaldim_markdown")
|
| 593 |
geo_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 594 |
geo_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 595 |
geo_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 596 |
|
|
|
|
| 597 |
with gr.Row(elem_id="Texture Quality"):
|
| 598 |
text_md = gr.Markdown("Texture Quality: ", elem_id="evaldim_markdown")
|
| 599 |
text_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 600 |
text_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 601 |
text_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 602 |
+
|
| 603 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
| 604 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", elem_id="evaldim_markdown")
|
| 605 |
+
coherence_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 606 |
+
coherence_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 607 |
+
coherence_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
| 608 |
+
|
| 609 |
+
with gr.Row(elem_id="Semantic Alignment"):
|
| 610 |
+
align_md = gr.Markdown("Semantic Alignment: ", elem_id="evaldim_markdown")
|
| 611 |
align_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
| 612 |
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
| 613 |
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
|
|
|
| 632 |
geo_btn_list = [geo_upvote_btn, geo_downvote_btn, geo_flag_btn]
|
| 633 |
text_btn_list = [text_upvote_btn, text_downvote_btn, text_flag_btn]
|
| 634 |
align_btn_list = [align_upvote_btn, align_downvote_btn, align_flag_btn]
|
| 635 |
+
plausive_btn_list = [plausive_upvote_btn, plausive_downvote_btn, plausive_flag_btn]
|
| 636 |
+
coherence_btn_list = [coherence_upvote_btn, coherence_downvote_btn, coherence_flag_btn]
|
| 637 |
+
dim_md_list = [geo_md, text_md, align_md, plausive_md, coherence_md]
|
| 638 |
+
vote_btn_list = geo_btn_list + text_btn_list + align_btn_list + plausive_btn_list + coherence_btn_list
|
| 639 |
|
| 640 |
+
for dim_md, btn_list in zip(dim_md_list, [geo_btn_list, text_btn_list, align_btn_list, plausive_btn_list, coherence_btn_list]):
|
|
|
|
| 641 |
upvote_btn, downvote_btn, flag_btn = btn_list
|
| 642 |
|
| 643 |
upvote_btn.click(
|
|
|
|
| 667 |
textbox.submit(
|
| 668 |
reset_state,
|
| 669 |
state,
|
| 670 |
+
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
| 671 |
).then(
|
| 672 |
gen_func,
|
| 673 |
[state, textbox, model_selector],
|
|
|
|
| 677 |
).then(
|
| 678 |
enable_buttons,
|
| 679 |
None,
|
| 680 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 681 |
)
|
| 682 |
|
| 683 |
send_btn.click(
|
| 684 |
reset_state,
|
| 685 |
state,
|
| 686 |
+
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
| 687 |
).then(
|
| 688 |
gen_func,
|
| 689 |
[state, textbox, model_selector],
|
|
|
|
| 693 |
).then(
|
| 694 |
enable_buttons,
|
| 695 |
None,
|
| 696 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 697 |
)
|
| 698 |
|
| 699 |
clear_btn.click(
|
|
|
|
| 705 |
).then(
|
| 706 |
disable_buttons,
|
| 707 |
None,
|
| 708 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 709 |
)
|
| 710 |
|
| 711 |
regenerate_btn.click(
|
| 712 |
reset_state,
|
| 713 |
state,
|
| 714 |
+
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
| 715 |
).then(
|
| 716 |
gen_func,
|
| 717 |
[state, textbox, model_selector],
|
|
|
|
| 721 |
).then(
|
| 722 |
enable_buttons,
|
| 723 |
None,
|
| 724 |
+
vote_btn_list + [regenerate_btn, clear_btn]
|
| 725 |
)
|
| 726 |
|
serve/inference.py
CHANGED
|
@@ -666,10 +666,6 @@ def generate_i2s_multi_annoy(gen_func, render_func,
|
|
| 666 |
# rgb_video_0 = os.path.join(OFFLINE_DIR, "image2shape", model_name_0, "rgb", f"{state_0.offline_idx}.mp4")
|
| 667 |
# normal_video_1 = os.path.join(OFFLINE_DIR, "image2shape", model_name_1, "normal", f"{state_1.offline_idx}.mp4")
|
| 668 |
# rgb_video_1 = os.path.join(OFFLINE_DIR, "image2shape", model_name_1, "rgb", f"{state_1.offline_idx}.mp4")
|
| 669 |
-
print(state_0.dict())
|
| 670 |
-
print(state_1.dict())
|
| 671 |
-
print(videos_0)
|
| 672 |
-
print(videos_1)
|
| 673 |
state_0.model_name, state_1.model_name = model_name_0, model_name_1
|
| 674 |
state_0.normal_video, state_0.rgb_video = videos_0['normal'], videos_0['rgb']
|
| 675 |
state_1.normal_video, state_1.rgb_video = videos_1['normal'], videos_1['rgb']
|
|
|
|
| 666 |
# rgb_video_0 = os.path.join(OFFLINE_DIR, "image2shape", model_name_0, "rgb", f"{state_0.offline_idx}.mp4")
|
| 667 |
# normal_video_1 = os.path.join(OFFLINE_DIR, "image2shape", model_name_1, "normal", f"{state_1.offline_idx}.mp4")
|
| 668 |
# rgb_video_1 = os.path.join(OFFLINE_DIR, "image2shape", model_name_1, "rgb", f"{state_1.offline_idx}.mp4")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
state_0.model_name, state_1.model_name = model_name_0, model_name_1
|
| 670 |
state_0.normal_video, state_0.rgb_video = videos_0['normal'], videos_0['rgb']
|
| 671 |
state_1.normal_video, state_1.rgb_video = videos_1['normal'], videos_1['rgb']
|
serve/utils.py
CHANGED
|
@@ -7,7 +7,7 @@ import numpy as np
|
|
| 7 |
import gradio as gr
|
| 8 |
from pathlib import Path
|
| 9 |
from model.model_registry import *
|
| 10 |
-
from constants import LOGDIR, LOG_SERVER_ADDR, APPEND_JSON, SAVE_IMAGE, SAVE_LOG
|
| 11 |
from typing import Union
|
| 12 |
|
| 13 |
|
|
@@ -101,35 +101,35 @@ footer {
|
|
| 101 |
}
|
| 102 |
"""
|
| 103 |
def enable_mds():
|
| 104 |
-
return tuple(gr.update(visible=True) for _ in range(
|
| 105 |
|
| 106 |
def disable_mds():
|
| 107 |
-
return tuple(gr.update(visible=False) for _ in range(
|
| 108 |
|
| 109 |
def enable_buttons_side_by_side():
|
| 110 |
-
return tuple(gr.update(visible=True, interactive=True) for i in range(
|
| 111 |
|
| 112 |
def disable_buttons_side_by_side():
|
| 113 |
-
return tuple(gr.update(visible=i>=
|
| 114 |
|
| 115 |
def enable_buttons():
|
| 116 |
-
return tuple(gr.update(interactive=True) for _ in range(
|
| 117 |
|
| 118 |
def disable_buttons():
|
| 119 |
-
return tuple(gr.update(interactive=False) for _ in range(
|
| 120 |
|
| 121 |
def reset_state(state):
|
| 122 |
state.normal_video, state.rgb_video = None, None
|
| 123 |
state.evaluted_dims = 0
|
| 124 |
-
return (state,) + tuple(gr.update(interactive=False) for _ in range(
|
| 125 |
|
| 126 |
def reset_states_side_by_side(state_0, state_1):
|
| 127 |
state_0.normal_video, state_0.rgb_video = None, None
|
| 128 |
state_1.normal_video, state_1.rgb_video = None, None
|
| 129 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
| 130 |
return (state_0, state_1) \
|
| 131 |
-
+ tuple(gr.update(visible=i>=
|
| 132 |
-
+ tuple(gr.update(visible=False) for _ in range(
|
| 133 |
|
| 134 |
def reset_states_side_by_side_anony(state_0, state_1):
|
| 135 |
state_0.model_name, state_1.model_name = "", ""
|
|
@@ -138,8 +138,8 @@ def reset_states_side_by_side_anony(state_0, state_1):
|
|
| 138 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
| 139 |
return (state_0, state_1) \
|
| 140 |
+ (gr.Markdown("", visible=False), gr.Markdown("", visible=False))\
|
| 141 |
-
+ tuple(gr.update(visible=i>=
|
| 142 |
-
+ tuple(gr.update(visible=False) for _ in range(
|
| 143 |
|
| 144 |
def clear_t2s_history():
|
| 145 |
return None, "", None, None
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
from pathlib import Path
|
| 9 |
from model.model_registry import *
|
| 10 |
+
from constants import LOGDIR, LOG_SERVER_ADDR, APPEND_JSON, SAVE_IMAGE, SAVE_LOG, EVALUATE_DIMS
|
| 11 |
from typing import Union
|
| 12 |
|
| 13 |
|
|
|
|
| 101 |
}
|
| 102 |
"""
|
| 103 |
def enable_mds():
|
| 104 |
+
return tuple(gr.update(visible=True) for _ in range(EVALUATE_DIMS))
|
| 105 |
|
| 106 |
def disable_mds():
|
| 107 |
+
return tuple(gr.update(visible=False) for _ in range(EVALUATE_DIMS))
|
| 108 |
|
| 109 |
def enable_buttons_side_by_side():
|
| 110 |
+
return tuple(gr.update(visible=True, interactive=True) for i in range(EVALUATE_DIMS*4 + 2))
|
| 111 |
|
| 112 |
def disable_buttons_side_by_side():
|
| 113 |
+
return tuple(gr.update(visible=(i>=EVALUATE_DIMS*4), interactive=False) for i in range(EVALUATE_DIMS*4 + 2))
|
| 114 |
|
| 115 |
def enable_buttons():
|
| 116 |
+
return tuple(gr.update(interactive=True) for _ in range(EVALUATE_DIMS*3 + 2))
|
| 117 |
|
| 118 |
def disable_buttons():
|
| 119 |
+
return tuple(gr.update(interactive=False) for _ in range(EVALUATE_DIMS*3 + 2))
|
| 120 |
|
| 121 |
def reset_state(state):
|
| 122 |
state.normal_video, state.rgb_video = None, None
|
| 123 |
state.evaluted_dims = 0
|
| 124 |
+
return (state,) + tuple(gr.update(interactive=False) for _ in range(EVALUATE_DIMS*3 + 2))
|
| 125 |
|
| 126 |
def reset_states_side_by_side(state_0, state_1):
|
| 127 |
state_0.normal_video, state_0.rgb_video = None, None
|
| 128 |
state_1.normal_video, state_1.rgb_video = None, None
|
| 129 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
| 130 |
return (state_0, state_1) \
|
| 131 |
+
+ tuple(gr.update(visible=(i>=EVALUATE_DIMS*4), interactive=False) for i in range(EVALUATE_DIMS*4 + 2)) \
|
| 132 |
+
+ tuple(gr.update(visible=False) for _ in range(EVALUATE_DIMS))
|
| 133 |
|
| 134 |
def reset_states_side_by_side_anony(state_0, state_1):
|
| 135 |
state_0.model_name, state_1.model_name = "", ""
|
|
|
|
| 138 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
| 139 |
return (state_0, state_1) \
|
| 140 |
+ (gr.Markdown("", visible=False), gr.Markdown("", visible=False))\
|
| 141 |
+
+ tuple(gr.update(visible=(i>=EVALUATE_DIMS*4), interactive=False) for i in range(EVALUATE_DIMS*4 + 2)) \
|
| 142 |
+
+ tuple(gr.update(visible=False) for _ in range(EVALUATE_DIMS))
|
| 143 |
|
| 144 |
def clear_t2s_history():
|
| 145 |
return None, "", None, None
|
serve/vote_utils.py
CHANGED
|
@@ -6,7 +6,7 @@ import gradio as gr
|
|
| 6 |
from pathlib import Path
|
| 7 |
from .utils import *
|
| 8 |
from .log_utils import build_logger
|
| 9 |
-
from constants import IMAGE_DIR
|
| 10 |
|
| 11 |
t2s_logger = build_logger("gradio_web_server_text2shape", "gr_web_text2shape.log") # t2s = image generation, loggers for single model direct chat
|
| 12 |
t2s_multi_logger = build_logger("gradio_web_server_text2shape_multi", "gr_web_text2shape_multi.log") # t2s_multi = image generation multi, loggers for side-by-side and battle
|
|
@@ -167,7 +167,7 @@ def leftvote_last_response_t2s_anony(
|
|
| 167 |
|
| 168 |
state0.evaluted_dims += 1
|
| 169 |
state1.evaluted_dims += 1
|
| 170 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 171 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 172 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 173 |
else:
|
|
@@ -183,7 +183,7 @@ def rightvote_last_response_t2s_anony(
|
|
| 183 |
|
| 184 |
state0.evaluted_dims += 1
|
| 185 |
state1.evaluted_dims += 1
|
| 186 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 187 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 188 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 189 |
else:
|
|
@@ -199,7 +199,7 @@ def tievote_last_response_t2s_anony(
|
|
| 199 |
|
| 200 |
state0.evaluted_dims += 1
|
| 201 |
state1.evaluted_dims += 1
|
| 202 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 203 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 204 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 205 |
else:
|
|
@@ -215,7 +215,7 @@ def bothbad_vote_last_response_t2s_anony(
|
|
| 215 |
|
| 216 |
state0.evaluted_dims += 1
|
| 217 |
state1.evaluted_dims += 1
|
| 218 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 219 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 220 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 221 |
else:
|
|
@@ -300,7 +300,7 @@ def leftvote_last_response_i2s_anony(
|
|
| 300 |
|
| 301 |
state0.evaluted_dims += 1
|
| 302 |
state1.evaluted_dims += 1
|
| 303 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 304 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 305 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 306 |
else:
|
|
@@ -317,7 +317,7 @@ def rightvote_last_response_i2s_anony(
|
|
| 317 |
|
| 318 |
state0.evaluted_dims += 1
|
| 319 |
state1.evaluted_dims += 1
|
| 320 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 321 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 322 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 323 |
else:
|
|
@@ -334,7 +334,7 @@ def tievote_last_response_i2s_anony(
|
|
| 334 |
|
| 335 |
state0.evaluted_dims += 1
|
| 336 |
state1.evaluted_dims += 1
|
| 337 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 338 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 339 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 340 |
else:
|
|
@@ -351,7 +351,7 @@ def bothbad_vote_last_response_i2s_anony(
|
|
| 351 |
|
| 352 |
state0.evaluted_dims += 1
|
| 353 |
state1.evaluted_dims += 1
|
| 354 |
-
if state0.evaluted_dims == state1.evaluted_dims ==
|
| 355 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 356 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 357 |
else:
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
from .utils import *
|
| 8 |
from .log_utils import build_logger
|
| 9 |
+
from constants import IMAGE_DIR, EVALUATE_DIMS
|
| 10 |
|
| 11 |
t2s_logger = build_logger("gradio_web_server_text2shape", "gr_web_text2shape.log") # t2s = image generation, loggers for single model direct chat
|
| 12 |
t2s_multi_logger = build_logger("gradio_web_server_text2shape_multi", "gr_web_text2shape_multi.log") # t2s_multi = image generation multi, loggers for side-by-side and battle
|
|
|
|
| 167 |
|
| 168 |
state0.evaluted_dims += 1
|
| 169 |
state1.evaluted_dims += 1
|
| 170 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 171 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 172 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 173 |
else:
|
|
|
|
| 183 |
|
| 184 |
state0.evaluted_dims += 1
|
| 185 |
state1.evaluted_dims += 1
|
| 186 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 187 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 188 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 189 |
else:
|
|
|
|
| 199 |
|
| 200 |
state0.evaluted_dims += 1
|
| 201 |
state1.evaluted_dims += 1
|
| 202 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 203 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 204 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 205 |
else:
|
|
|
|
| 215 |
|
| 216 |
state0.evaluted_dims += 1
|
| 217 |
state1.evaluted_dims += 1
|
| 218 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 219 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 220 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 221 |
else:
|
|
|
|
| 300 |
|
| 301 |
state0.evaluted_dims += 1
|
| 302 |
state1.evaluted_dims += 1
|
| 303 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 304 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 305 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 306 |
else:
|
|
|
|
| 317 |
|
| 318 |
state0.evaluted_dims += 1
|
| 319 |
state1.evaluted_dims += 1
|
| 320 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 321 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 322 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 323 |
else:
|
|
|
|
| 334 |
|
| 335 |
state0.evaluted_dims += 1
|
| 336 |
state1.evaluted_dims += 1
|
| 337 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 338 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 339 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 340 |
else:
|
|
|
|
| 351 |
|
| 352 |
state0.evaluted_dims += 1
|
| 353 |
state1.evaluted_dims += 1
|
| 354 |
+
if state0.evaluted_dims == state1.evaluted_dims == EVALUATE_DIMS:
|
| 355 |
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
| 356 |
return (state0, state1) + (disable_btn,) * 4 + names
|
| 357 |
else:
|