Spaces:
Running
Running
ZhangYuhan
commited on
Commit
•
3e3ca46
1
Parent(s):
7bb496b
update serve
Browse files- app.py +1 -1
- constants.py +2 -4
- model/model_config.py +67 -11
- model/model_manager.py +1 -1
- model/model_registry.py +16 -9
- model/model_worker.py +17 -10
- offline/utils.py +0 -73
- serve/gradio_web_i2s.py +311 -167
- serve/gradio_web_t2i_anony.py +0 -225
- serve/gradio_web_t2i_named.py +0 -236
- serve/gradio_web_t2i_single.py +0 -159
- serve/gradio_web_t2s.py +246 -163
- serve/inference.py +11 -20
- serve/log_server.py +0 -1
- serve/utils.py +5 -1
app.py
CHANGED
@@ -81,4 +81,4 @@ if __name__ == "__main__":
|
|
81 |
# elo_results_file, leaderboard_table_file = load_elo_results(elo_results_dir)
|
82 |
elo_results_file, leaderboard_table_file = None, None
|
83 |
demo = build_combine_demo(models, elo_results_file, leaderboard_table_file)
|
84 |
-
demo.queue(max_size=20).launch(server_port=server_port, root_path=ROOT_PATH)
|
|
|
81 |
# elo_results_file, leaderboard_table_file = load_elo_results(elo_results_dir)
|
82 |
elo_results_file, leaderboard_table_file = None, None
|
83 |
demo = build_combine_demo(models, elo_results_file, leaderboard_table_file)
|
84 |
+
demo.queue(max_size=20).launch(server_port=server_port, root_path=ROOT_PATH, debug=True)
|
constants.py
CHANGED
@@ -5,8 +5,6 @@ os.chdir(Path.cwd())
|
|
5 |
|
6 |
LOGDIR = os.getenv("LOGDIR", "./3DGen-Arena-logs/vote_log")
|
7 |
IMAGE_DIR = os.getenv("IMAGE_DIR", f"{LOGDIR}/images")
|
8 |
-
OFFLINE_DIR = "./offline"
|
9 |
-
OFFLINE_GIF_DIR = os.path.join(OFFLINE_DIR, "gifs")
|
10 |
|
11 |
SERVER_PORT = os.getenv("SERVER_PORT", 7860)
|
12 |
ROOT_PATH = os.getenv("ROOT_PATH", None)
|
@@ -22,8 +20,8 @@ SAVE_LOG = "save_log"
|
|
22 |
|
23 |
NUM_SIDES = 2
|
24 |
EVALUATE_DIMS = 5
|
25 |
-
|
26 |
-
|
27 |
|
28 |
MAX_ATTEMPTS = 5
|
29 |
REPLICATE_API_TOKEN = os.getenv("REPLICATE_API_TOKEN", "yourKey")
|
|
|
5 |
|
6 |
LOGDIR = os.getenv("LOGDIR", "./3DGen-Arena-logs/vote_log")
|
7 |
IMAGE_DIR = os.getenv("IMAGE_DIR", f"{LOGDIR}/images")
|
|
|
|
|
8 |
|
9 |
SERVER_PORT = os.getenv("SERVER_PORT", 7860)
|
10 |
ROOT_PATH = os.getenv("ROOT_PATH", None)
|
|
|
20 |
|
21 |
NUM_SIDES = 2
|
22 |
EVALUATE_DIMS = 5
|
23 |
+
PROMPT_NUM = 510
|
24 |
+
TEXT_PROMPT_PATH = "offline/prompts.json"
|
25 |
|
26 |
MAX_ATTEMPTS = 5
|
27 |
REPLICATE_API_TOKEN = os.getenv("REPLICATE_API_TOKEN", "yourKey")
|
model/model_config.py
CHANGED
@@ -20,14 +20,20 @@ register_model_config(
|
|
20 |
online_model=False
|
21 |
)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
register_model_config(
|
24 |
-
model_name="
|
25 |
i2s_model=False,
|
26 |
online_model=False
|
27 |
)
|
28 |
|
29 |
register_model_config(
|
30 |
-
model_name="
|
31 |
i2s_model=False,
|
32 |
online_model=False
|
33 |
)
|
@@ -38,27 +44,77 @@ register_model_config(
|
|
38 |
online_model=False
|
39 |
)
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# register_model_config(
|
42 |
-
# model_name="
|
43 |
# i2s_model=False,
|
44 |
# online_model=False
|
45 |
# )
|
46 |
|
47 |
# register_model_config(
|
48 |
-
# model_name="
|
49 |
-
# i2s_model=
|
50 |
# online_model=False
|
51 |
# )
|
52 |
|
|
|
53 |
register_model_config(
|
54 |
-
model_name="
|
55 |
i2s_model=True,
|
56 |
online_model=False
|
57 |
)
|
58 |
|
59 |
register_model_config(
|
60 |
-
model_name="
|
61 |
-
i2s_model=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
online_model=False
|
63 |
)
|
64 |
|
@@ -75,19 +131,19 @@ register_model_config(
|
|
75 |
)
|
76 |
|
77 |
register_model_config(
|
78 |
-
model_name="
|
79 |
i2s_model=True,
|
80 |
online_model=False
|
81 |
)
|
82 |
|
83 |
register_model_config(
|
84 |
-
model_name="
|
85 |
i2s_model=True,
|
86 |
online_model=False
|
87 |
)
|
88 |
|
89 |
register_model_config(
|
90 |
-
model_name="
|
91 |
i2s_model=True,
|
92 |
online_model=False
|
93 |
)
|
|
|
20 |
online_model=False
|
21 |
)
|
22 |
|
23 |
+
# register_model_config(
|
24 |
+
# model_name="instant3d",
|
25 |
+
# i2s_model=False,
|
26 |
+
# online_model=False
|
27 |
+
# )
|
28 |
+
|
29 |
register_model_config(
|
30 |
+
model_name="latent-nerf",
|
31 |
i2s_model=False,
|
32 |
online_model=False
|
33 |
)
|
34 |
|
35 |
register_model_config(
|
36 |
+
model_name="lucid-dreamer",
|
37 |
i2s_model=False,
|
38 |
online_model=False
|
39 |
)
|
|
|
44 |
online_model=False
|
45 |
)
|
46 |
|
47 |
+
register_model_config(
|
48 |
+
model_name="mvdream",
|
49 |
+
i2s_model=False,
|
50 |
+
online_model=False
|
51 |
+
)
|
52 |
+
|
53 |
+
|
54 |
+
register_model_config(
|
55 |
+
model_name="point-e_t",
|
56 |
+
i2s_model=False,
|
57 |
+
online_model=False
|
58 |
+
)
|
59 |
+
|
60 |
+
register_model_config(
|
61 |
+
model_name="shap-e_t",
|
62 |
+
i2s_model=False,
|
63 |
+
online_model=False
|
64 |
+
)
|
65 |
+
|
66 |
+
register_model_config(
|
67 |
+
model_name="sjc",
|
68 |
+
i2s_model=False,
|
69 |
+
online_model=False
|
70 |
+
)
|
71 |
# register_model_config(
|
72 |
+
# model_name="prolificdreamer",
|
73 |
# i2s_model=False,
|
74 |
# online_model=False
|
75 |
# )
|
76 |
|
77 |
# register_model_config(
|
78 |
+
# model_name="dreamgaussian",
|
79 |
+
# i2s_model=True,
|
80 |
# online_model=False
|
81 |
# )
|
82 |
|
83 |
+
|
84 |
register_model_config(
|
85 |
+
model_name="escher-net",
|
86 |
i2s_model=True,
|
87 |
online_model=False
|
88 |
)
|
89 |
|
90 |
register_model_config(
|
91 |
+
model_name="free3d",
|
92 |
+
i2s_model=True,
|
93 |
+
online_model=False
|
94 |
+
)
|
95 |
+
|
96 |
+
register_model_config(
|
97 |
+
model_name="lgm",
|
98 |
+
i2s_model=True,
|
99 |
+
online_model=False
|
100 |
+
)
|
101 |
+
|
102 |
+
register_model_config(
|
103 |
+
model_name="openlrm",
|
104 |
+
i2s_model=True,
|
105 |
+
online_model=False
|
106 |
+
)
|
107 |
+
|
108 |
+
|
109 |
+
register_model_config(
|
110 |
+
model_name="point-e_i",
|
111 |
+
i2s_model=True,
|
112 |
+
online_model=False
|
113 |
+
)
|
114 |
+
|
115 |
+
register_model_config(
|
116 |
+
model_name="shap-e_i",
|
117 |
+
i2s_model=True,
|
118 |
online_model=False
|
119 |
)
|
120 |
|
|
|
131 |
)
|
132 |
|
133 |
register_model_config(
|
134 |
+
model_name="triplane-gaussian",
|
135 |
i2s_model=True,
|
136 |
online_model=False
|
137 |
)
|
138 |
|
139 |
register_model_config(
|
140 |
+
model_name="zero123-xl",
|
141 |
i2s_model=True,
|
142 |
online_model=False
|
143 |
)
|
144 |
|
145 |
register_model_config(
|
146 |
+
model_name="stable-zero123",
|
147 |
i2s_model=True,
|
148 |
online_model=False
|
149 |
)
|
model/model_manager.py
CHANGED
@@ -68,7 +68,7 @@ class ModelManager:
|
|
68 |
worker = self.models_worker[model_name]
|
69 |
|
70 |
if offline:
|
71 |
-
result = worker.load_offline(
|
72 |
if not offline or result == None:
|
73 |
if worker.check_online():
|
74 |
result = worker.inference(prompt)
|
|
|
68 |
worker = self.models_worker[model_name]
|
69 |
|
70 |
if offline:
|
71 |
+
result = worker.load_offline(offline_idx)
|
72 |
if not offline or result == None:
|
73 |
if worker.check_online():
|
74 |
result = worker.inference(prompt)
|
model/model_registry.py
CHANGED
@@ -103,14 +103,14 @@ register_model_info(
|
|
103 |
)
|
104 |
|
105 |
register_model_info(
|
106 |
-
["point-
|
107 |
"Point·E",
|
108 |
"https://github.com/openai/point-e",
|
109 |
"A System for Generating 3D Point Clouds from Complex Prompts",
|
110 |
)
|
111 |
|
112 |
register_model_info(
|
113 |
-
["shap-
|
114 |
"Shap-E",
|
115 |
"https://github.com/openai/shap-e",
|
116 |
"Generating Conditional 3D Implicit Functions",
|
@@ -123,13 +123,6 @@ register_model_info(
|
|
123 |
"High-Fidelity and Diverse Text-to-3D Generation with Variational Score Distillation",
|
124 |
)
|
125 |
|
126 |
-
register_model_info(
|
127 |
-
["syncdreamer"],
|
128 |
-
"SyncDreamer",
|
129 |
-
"https://github.com/liuyuan-pal/SyncDreamer",
|
130 |
-
"Generating Multiview-consistent Images from a Single-view Image",
|
131 |
-
)
|
132 |
-
|
133 |
register_model_info(
|
134 |
["sjc"],
|
135 |
"Score Jacobian Chaining",
|
@@ -168,6 +161,13 @@ register_model_info(
|
|
168 |
"Hierarchical 3d generation with bootstrapped diffusion prior",
|
169 |
)
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
register_model_info(
|
172 |
["zero123"],
|
173 |
"Zero-1-to-3",
|
@@ -182,6 +182,13 @@ register_model_info(
|
|
182 |
"Quality 3D Object Generation from Single Images",
|
183 |
)
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
register_model_info(
|
186 |
["magic123"],
|
187 |
"Magic123",
|
|
|
103 |
)
|
104 |
|
105 |
register_model_info(
|
106 |
+
["point-e_t", "point-e_i"],
|
107 |
"Point·E",
|
108 |
"https://github.com/openai/point-e",
|
109 |
"A System for Generating 3D Point Clouds from Complex Prompts",
|
110 |
)
|
111 |
|
112 |
register_model_info(
|
113 |
+
["shap-e_t", "shap-e_i"],
|
114 |
"Shap-E",
|
115 |
"https://github.com/openai/shap-e",
|
116 |
"Generating Conditional 3D Implicit Functions",
|
|
|
123 |
"High-Fidelity and Diverse Text-to-3D Generation with Variational Score Distillation",
|
124 |
)
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
register_model_info(
|
127 |
["sjc"],
|
128 |
"Score Jacobian Chaining",
|
|
|
161 |
"Hierarchical 3d generation with bootstrapped diffusion prior",
|
162 |
)
|
163 |
|
164 |
+
register_model_info(
|
165 |
+
["syncdreamer"],
|
166 |
+
"SyncDreamer",
|
167 |
+
"https://github.com/liuyuan-pal/SyncDreamer",
|
168 |
+
"Generating Multiview-consistent Images from a Single-view Image",
|
169 |
+
)
|
170 |
+
|
171 |
register_model_info(
|
172 |
["zero123"],
|
173 |
"Zero-1-to-3",
|
|
|
182 |
"Quality 3D Object Generation from Single Images",
|
183 |
)
|
184 |
|
185 |
+
register_model_info(
|
186 |
+
["zero123-xl"],
|
187 |
+
"Zero123-XL",
|
188 |
+
"https://stability.ai/news/stable-zero123-3d-generation",
|
189 |
+
"Quality 3D Object Generation from Single Images",
|
190 |
+
)
|
191 |
+
|
192 |
register_model_info(
|
193 |
["magic123"],
|
194 |
"Magic123",
|
model/model_worker.py
CHANGED
@@ -6,9 +6,10 @@ from typing import List
|
|
6 |
import replicate
|
7 |
import subprocess
|
8 |
|
|
|
9 |
from gradio_client import Client
|
10 |
# from .client import Gau2Mesh_client
|
11 |
-
from constants import
|
12 |
# os.environ("REPLICATE_API_TOKEN", "yourKey")
|
13 |
|
14 |
class BaseModelWorker:
|
@@ -24,10 +25,10 @@ class BaseModelWorker:
|
|
24 |
self.model_api = model_api
|
25 |
self.urls_json = None
|
26 |
|
27 |
-
urls_json_path = os.path.join(OFFLINE_GIF_DIR, f"{model_name}.json")
|
28 |
-
if os.path.exists(urls_json_path):
|
29 |
-
|
30 |
-
|
31 |
|
32 |
def check_online(self) -> bool:
|
33 |
if self.online_model and not self.model:
|
@@ -35,12 +36,18 @@ class BaseModelWorker:
|
|
35 |
else:
|
36 |
return False
|
37 |
|
38 |
-
def load_offline(self,
|
39 |
## offline
|
40 |
-
if offline and str(offline_idx) in self.urls_json.keys():
|
41 |
-
|
42 |
-
else:
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
def inference(self, prompt):
|
46 |
pass
|
|
|
6 |
import replicate
|
7 |
import subprocess
|
8 |
|
9 |
+
import requests
|
10 |
from gradio_client import Client
|
11 |
# from .client import Gau2Mesh_client
|
12 |
+
from constants import REPLICATE_API_TOKEN, LOG_SERVER
|
13 |
# os.environ("REPLICATE_API_TOKEN", "yourKey")
|
14 |
|
15 |
class BaseModelWorker:
|
|
|
25 |
self.model_api = model_api
|
26 |
self.urls_json = None
|
27 |
|
28 |
+
# urls_json_path = os.path.join(OFFLINE_GIF_DIR, f"{model_name}.json")
|
29 |
+
# if os.path.exists(urls_json_path):
|
30 |
+
# with open(urls_json_path, 'r') as f:
|
31 |
+
# self.urls_json = json.load(f)
|
32 |
|
33 |
def check_online(self) -> bool:
|
34 |
if self.online_model and not self.model:
|
|
|
36 |
else:
|
37 |
return False
|
38 |
|
39 |
+
def load_offline(self, offline_idx):
|
40 |
## offline
|
41 |
+
# if offline and str(offline_idx) in self.urls_json.keys():
|
42 |
+
# # return self.urls_json[str(offline_idx)]
|
43 |
+
# else:
|
44 |
+
# return None
|
45 |
+
galley = "image2shape" if self.i2s_model else "text2shape"
|
46 |
+
rgb_name = f"{galley}_{self.model_name}_{offline_idx}_rgb"
|
47 |
+
normal_name = f"{galley}_{self.model_name}_{offline_idx}_normal"
|
48 |
+
rgb_url = f"{LOG_SERVER}/get_{rgb_name}"
|
49 |
+
normal_url = f"{LOG_SERVER}/get_{normal_name}"
|
50 |
+
return {'rgb': rgb_url, 'normal': normal_url}
|
51 |
|
52 |
def inference(self, prompt):
|
53 |
pass
|
offline/utils.py
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import json
|
3 |
-
import base64
|
4 |
-
import requests
|
5 |
-
import numpy as np
|
6 |
-
import matplotlib.pyplot as plt
|
7 |
-
|
8 |
-
# MAX_LEN = 40
|
9 |
-
# STEP = 2
|
10 |
-
# x = np.arange(0, MAX_LEN, STEP)
|
11 |
-
# token_counts = [0] * (MAX_LEN//STEP)
|
12 |
-
|
13 |
-
# with open("prompts.json", 'r') as f:
|
14 |
-
# prompts = json.load(f)
|
15 |
-
|
16 |
-
# for prompt in prompts:
|
17 |
-
# tokens = len(prompt.strip().split(' '))
|
18 |
-
# token_counts[min(tokens//STEP, MAX_LEN//STEP-1)] += 1
|
19 |
-
|
20 |
-
# plt.xticks(x, x+1)
|
21 |
-
# plt.xlabel("token counts")
|
22 |
-
# plt.bar(x, token_counts, width=1.3)
|
23 |
-
# # plt.show()
|
24 |
-
# plt.savefig("token_counts.png")
|
25 |
-
|
26 |
-
## Generate image prompts
|
27 |
-
with open("prompts.json") as f:
|
28 |
-
text_prompts = json.load(f)
|
29 |
-
|
30 |
-
engine_id = "stable-diffusion-v1-6"
|
31 |
-
api_host = os.getenv('API_HOST', 'https://api.stability.ai')
|
32 |
-
api_key = os.getenv("STABILITY_API_KEY", "sk-ZvoFiXEbln6yh0hvSlm1K60WYcWFY5rmyW8a9FgoVBrKKP9N")
|
33 |
-
|
34 |
-
if api_key is None:
|
35 |
-
raise Exception("Missing Stability API key.")
|
36 |
-
|
37 |
-
for idx, text in enumerate(text_prompts):
|
38 |
-
if idx<=20: continue
|
39 |
-
print(f"Start generate prompt[{idx}]: {text}")
|
40 |
-
response = requests.post(
|
41 |
-
f"{api_host}/v1/generation/{engine_id}/text-to-image",
|
42 |
-
headers={
|
43 |
-
"Content-Type": "application/json",
|
44 |
-
"Accept": "application/json",
|
45 |
-
"Authorization": f"Bearer {api_key}"
|
46 |
-
},
|
47 |
-
json={
|
48 |
-
"text_prompts": [
|
49 |
-
{
|
50 |
-
"text": text.strip()
|
51 |
-
}
|
52 |
-
],
|
53 |
-
"cfg_scale": 7,
|
54 |
-
"height": 1024,
|
55 |
-
"width": 1024,
|
56 |
-
"samples": 3,
|
57 |
-
"steps": 30,
|
58 |
-
},
|
59 |
-
)
|
60 |
-
|
61 |
-
if response.status_code != 200:
|
62 |
-
# raise Exception("Non-200 response: " + str(response.text))
|
63 |
-
print(f"{idx} Failed!!! {str(response.text)}")
|
64 |
-
continue
|
65 |
-
|
66 |
-
print("Finished!")
|
67 |
-
data = response.json()
|
68 |
-
|
69 |
-
for i, image in enumerate(data["artifacts"]):
|
70 |
-
img_path = f"./images/{idx}/v1_txt2img_{i}.png"
|
71 |
-
os.makedirs(os.path.dirname(img_path), exist_ok=True)
|
72 |
-
with open(img_path, "wb") as f:
|
73 |
-
f.write(base64.b64decode(image["base64"]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serve/gradio_web_i2s.py
CHANGED
@@ -57,7 +57,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
57 |
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
58 |
|
59 |
with gr.Row():
|
60 |
-
with gr.Column():
|
61 |
imagebox = gr.Image(
|
62 |
width=512,
|
63 |
show_label=False,
|
@@ -65,7 +65,74 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
65 |
interactive=False, ## only support offline
|
66 |
label = "Prompt",
|
67 |
elem_id="input_box",
|
68 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
70 |
# send_btn = gr.Button(value="📤 Send", variant="primary")
|
71 |
# clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
@@ -83,7 +150,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
83 |
interactive=False, show_download_button=True,)
|
84 |
|
85 |
with gr.Row():
|
86 |
-
with gr.Column():
|
87 |
gr.Markdown("", visible=False)
|
88 |
with gr.Column():
|
89 |
model_selector_left =gr.Markdown("", visible=False)
|
@@ -92,76 +159,76 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
92 |
with gr.Row():
|
93 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
94 |
|
95 |
-
with gr.Row(elem_id="Geometry Plausibility"):
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
with gr.Row(elem_id="Geometry
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
with gr.Row(elem_id="Texture Quality"):
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
with gr.Row(elem_id="Visual Alignment"):
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
|
160 |
with gr.Row():
|
161 |
# sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
162 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
163 |
-
share_btn = gr.Button(value="📷 Share")
|
164 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
|
|
165 |
send_btn = gr.Button(value="📤 Send", variant="primary")
|
166 |
|
167 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
@@ -207,12 +274,16 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
207 |
states + model_selectors,
|
208 |
states + [imagebox],
|
209 |
api_name="sample_btn_anony"
|
|
|
|
|
|
|
|
|
210 |
)
|
211 |
|
212 |
imagebox.upload(
|
213 |
reset_states_side_by_side_anony,
|
214 |
states,
|
215 |
-
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn
|
216 |
).then(
|
217 |
gen_func,
|
218 |
states + [imagebox] + model_selectors,
|
@@ -231,7 +302,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
231 |
send_btn.click(
|
232 |
reset_states_side_by_side_anony,
|
233 |
states,
|
234 |
-
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn
|
235 |
).then(
|
236 |
gen_func,
|
237 |
states + [imagebox] + model_selectors,
|
@@ -265,7 +336,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
265 |
regenerate_btn.click(
|
266 |
reset_states_side_by_side_anony,
|
267 |
states,
|
268 |
-
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn
|
269 |
).then(
|
270 |
gen_func,
|
271 |
states + [imagebox] + model_selectors,
|
@@ -318,6 +389,8 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
318 |
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
319 |
|
320 |
with gr.Row():
|
|
|
|
|
321 |
with gr.Column():
|
322 |
model_selector_left = gr.Dropdown(
|
323 |
choices=model_list,
|
@@ -336,6 +409,81 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
336 |
)
|
337 |
|
338 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
|
340 |
with gr.Column():
|
341 |
normal_left = gr.Image(width=512, label = "Normal A", show_download_button=True)
|
@@ -344,87 +492,76 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
344 |
normal_right = gr.Image(width=512, label = "Normal B", show_download_button=True,)
|
345 |
rgb_right = gr.Image(width=512, label = "RGB B", show_download_button=True,)
|
346 |
|
347 |
-
with gr.Row(elem_id="Geometry Plausibility"):
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
with gr.Row(elem_id="Geometry Quality"):
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
with gr.Row(elem_id="Texture Quality"):
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
|
386 |
-
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
with gr.Row(elem_id="Visual Alignment"):
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
|
413 |
with gr.Row():
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
interactive=False, ## only support offline
|
419 |
-
elem_id="input_box",
|
420 |
-
)
|
421 |
-
|
422 |
-
with gr.Column():
|
423 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
424 |
-
send_btn = gr.Button(value="📤 Send", variant="primary")
|
425 |
-
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
426 |
-
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
427 |
-
share_btn = gr.Button(value="📷 Share")
|
428 |
|
429 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
430 |
|
@@ -499,12 +636,16 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
499 |
states + model_selectors,
|
500 |
states + [imagebox],
|
501 |
api_name="sample_btn_named"
|
|
|
|
|
|
|
|
|
502 |
)
|
503 |
|
504 |
imagebox.upload(
|
505 |
reset_states_side_by_side,
|
506 |
states,
|
507 |
-
states + vote_btn_list + [regenerate_btn, clear_btn
|
508 |
).then(
|
509 |
gen_func,
|
510 |
states + [imagebox] + model_selectors,
|
@@ -523,7 +664,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
523 |
send_btn.click(
|
524 |
reset_states_side_by_side,
|
525 |
states,
|
526 |
-
states + vote_btn_list + [regenerate_btn, clear_btn
|
527 |
).then(
|
528 |
gen_func,
|
529 |
states + [imagebox] + model_selectors,
|
@@ -557,7 +698,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
557 |
regenerate_btn.click(
|
558 |
reset_states_side_by_side,
|
559 |
states,
|
560 |
-
states + vote_btn_list + [regenerate_btn, clear_btn
|
561 |
).then(
|
562 |
gen_func,
|
563 |
states + [imagebox] + model_selectors,
|
@@ -607,6 +748,15 @@ def build_i2s_ui_single_model(models):
|
|
607 |
)
|
608 |
|
609 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
611 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
612 |
|
@@ -642,19 +792,9 @@ def build_i2s_ui_single_model(models):
|
|
642 |
|
643 |
|
644 |
with gr.Row():
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
visible=True,
|
649 |
-
interactive=False, ## only support offline
|
650 |
-
elem_id="input_box",
|
651 |
-
)
|
652 |
-
with gr.Column():
|
653 |
-
# with gr.Row():
|
654 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
655 |
-
send_btn = gr.Button(value="📤 Send", variant="primary")
|
656 |
-
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
657 |
-
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
658 |
|
659 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
660 |
|
@@ -704,12 +844,16 @@ def build_i2s_ui_single_model(models):
|
|
704 |
[state, model_selector],
|
705 |
[state, imagebox],
|
706 |
api_name="sample_btn_single"
|
|
|
|
|
|
|
|
|
707 |
)
|
708 |
|
709 |
imagebox.upload(
|
710 |
reset_state,
|
711 |
state,
|
712 |
-
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
713 |
).then(
|
714 |
gen_func,
|
715 |
[state, imagebox, model_selector],
|
@@ -725,7 +869,7 @@ def build_i2s_ui_single_model(models):
|
|
725 |
send_btn.click(
|
726 |
reset_state,
|
727 |
state,
|
728 |
-
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
729 |
).then(
|
730 |
gen_func,
|
731 |
[state, imagebox, model_selector],
|
@@ -753,7 +897,7 @@ def build_i2s_ui_single_model(models):
|
|
753 |
regenerate_btn.click(
|
754 |
reset_state,
|
755 |
state,
|
756 |
-
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
757 |
).then(
|
758 |
gen_func,
|
759 |
[state, imagebox, model_selector],
|
|
|
57 |
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
58 |
|
59 |
with gr.Row():
|
60 |
+
with gr.Column(scale=0.8):
|
61 |
imagebox = gr.Image(
|
62 |
width=512,
|
63 |
show_label=False,
|
|
|
65 |
interactive=False, ## only support offline
|
66 |
label = "Prompt",
|
67 |
elem_id="input_box",
|
68 |
+
)
|
69 |
+
|
70 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
71 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
72 |
+
plausive_leftvote_btn = gr.Button(
|
73 |
+
value="👈 A is better", visible=False, interactive=False
|
74 |
+
)
|
75 |
+
plausive_rightvote_btn = gr.Button(
|
76 |
+
value="👉 B is better", visible=False, interactive=False
|
77 |
+
)
|
78 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
79 |
+
plausive_bothbad_btn = gr.Button(
|
80 |
+
value="👎 Both are bad", visible=False, interactive=False
|
81 |
+
)
|
82 |
+
|
83 |
+
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
84 |
+
with gr.Row(elem_id="Geometry Details"):
|
85 |
+
geo_leftvote_btn = gr.Button(
|
86 |
+
value="👈 A is better", visible=False, interactive=False
|
87 |
+
)
|
88 |
+
geo_rightvote_btn = gr.Button(
|
89 |
+
value="👉 B is better", visible=False, interactive=False
|
90 |
+
)
|
91 |
+
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
92 |
+
geo_bothbad_btn = gr.Button(
|
93 |
+
value="👎 Both are bad", visible=False, interactive=False
|
94 |
+
)
|
95 |
+
|
96 |
+
text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
97 |
+
with gr.Row(elem_id="Texture Quality"):
|
98 |
+
text_leftvote_btn = gr.Button(
|
99 |
+
value="👈 A is better", visible=False, interactive=False
|
100 |
+
)
|
101 |
+
text_rightvote_btn = gr.Button(
|
102 |
+
value="👉 B is better", visible=False, interactive=False
|
103 |
+
)
|
104 |
+
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
105 |
+
text_bothbad_btn = gr.Button(
|
106 |
+
value="👎 Both are bad", visible=False, interactive=False
|
107 |
+
)
|
108 |
+
|
109 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
110 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
111 |
+
coherence_leftvote_btn = gr.Button(
|
112 |
+
value="👈 A is better", visible=False, interactive=False
|
113 |
+
)
|
114 |
+
coherence_rightvote_btn = gr.Button(
|
115 |
+
value="👉 B is better", visible=False, interactive=False
|
116 |
+
)
|
117 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
118 |
+
coherence_bothbad_btn = gr.Button(
|
119 |
+
value="👎 Both are bad", visible=False, interactive=False
|
120 |
+
)
|
121 |
+
|
122 |
+
align_md = gr.Markdown("Visual Alignment: ", visible=False, elem_id="evaldim_markdown")
|
123 |
+
with gr.Row(elem_id="Visual Alignment"):
|
124 |
+
align_leftvote_btn = gr.Button(
|
125 |
+
value="👈 A is better", visible=False, interactive=False
|
126 |
+
)
|
127 |
+
align_rightvote_btn = gr.Button(
|
128 |
+
value="👉 B is better", visible=False, interactive=False
|
129 |
+
)
|
130 |
+
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
131 |
+
align_bothbad_btn = gr.Button(
|
132 |
+
value="👎 Both are bad", visible=False, interactive=False
|
133 |
+
)
|
134 |
+
|
135 |
+
|
136 |
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
137 |
# send_btn = gr.Button(value="📤 Send", variant="primary")
|
138 |
# clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
|
|
150 |
interactive=False, show_download_button=True,)
|
151 |
|
152 |
with gr.Row():
|
153 |
+
with gr.Column(scale=0.8):
|
154 |
gr.Markdown("", visible=False)
|
155 |
with gr.Column():
|
156 |
model_selector_left =gr.Markdown("", visible=False)
|
|
|
159 |
with gr.Row():
|
160 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
161 |
|
162 |
+
# with gr.Row(elem_id="Geometry Plausibility"):
|
163 |
+
# plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
164 |
+
# plausive_leftvote_btn = gr.Button(
|
165 |
+
# value="👈 A is better", visible=False, interactive=False
|
166 |
+
# )
|
167 |
+
# plausive_rightvote_btn = gr.Button(
|
168 |
+
# value="👉 B is better", visible=False, interactive=False
|
169 |
+
# )
|
170 |
+
# plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
171 |
+
# plausive_bothbad_btn = gr.Button(
|
172 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
173 |
+
# )
|
174 |
+
|
175 |
+
# with gr.Row(elem_id="Geometry Details"):
|
176 |
+
# geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
177 |
+
# geo_leftvote_btn = gr.Button(
|
178 |
+
# value="👈 A is better", visible=False, interactive=False
|
179 |
+
# )
|
180 |
+
# geo_rightvote_btn = gr.Button(
|
181 |
+
# value="👉 B is better", visible=False, interactive=False
|
182 |
+
# )
|
183 |
+
# geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
184 |
+
# geo_bothbad_btn = gr.Button(
|
185 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
186 |
+
# )
|
187 |
+
|
188 |
+
# with gr.Row(elem_id="Texture Quality"):
|
189 |
+
# text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
190 |
+
# text_leftvote_btn = gr.Button(
|
191 |
+
# value="👈 A is better", visible=False, interactive=False
|
192 |
+
# )
|
193 |
+
# text_rightvote_btn = gr.Button(
|
194 |
+
# value="👉 B is better", visible=False, interactive=False
|
195 |
+
# )
|
196 |
+
# text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
197 |
+
# text_bothbad_btn = gr.Button(
|
198 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
199 |
+
# )
|
200 |
|
201 |
+
# with gr.Row(elem_id="Geometry-Texture Coherency"):
|
202 |
+
# coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
203 |
+
# coherence_leftvote_btn = gr.Button(
|
204 |
+
# value="👈 A is better", visible=False, interactive=False
|
205 |
+
# )
|
206 |
+
# coherence_rightvote_btn = gr.Button(
|
207 |
+
# value="👉 B is better", visible=False, interactive=False
|
208 |
+
# )
|
209 |
+
# coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
210 |
+
# coherence_bothbad_btn = gr.Button(
|
211 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
212 |
+
# )
|
213 |
+
|
214 |
+
# with gr.Row(elem_id="Visual Alignment"):
|
215 |
+
# align_md = gr.Markdown("Visual Alignment: ", visible=False, elem_id="evaldim_markdown")
|
216 |
+
# align_leftvote_btn = gr.Button(
|
217 |
+
# value="👈 A is better", visible=False, interactive=False
|
218 |
+
# )
|
219 |
+
# align_rightvote_btn = gr.Button(
|
220 |
+
# value="👉 B is better", visible=False, interactive=False
|
221 |
+
# )
|
222 |
+
# align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
223 |
+
# align_bothbad_btn = gr.Button(
|
224 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
225 |
+
# )
|
226 |
|
227 |
with gr.Row():
|
228 |
# sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
229 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
|
|
230 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
231 |
+
share_btn = gr.Button(value="📷 Share")
|
232 |
send_btn = gr.Button(value="📤 Send", variant="primary")
|
233 |
|
234 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
|
|
274 |
states + model_selectors,
|
275 |
states + [imagebox],
|
276 |
api_name="sample_btn_anony"
|
277 |
+
).then(
|
278 |
+
reset_states_side_by_side_anony,
|
279 |
+
states,
|
280 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
281 |
)
|
282 |
|
283 |
imagebox.upload(
|
284 |
reset_states_side_by_side_anony,
|
285 |
states,
|
286 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
287 |
).then(
|
288 |
gen_func,
|
289 |
states + [imagebox] + model_selectors,
|
|
|
302 |
send_btn.click(
|
303 |
reset_states_side_by_side_anony,
|
304 |
states,
|
305 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
306 |
).then(
|
307 |
gen_func,
|
308 |
states + [imagebox] + model_selectors,
|
|
|
336 |
regenerate_btn.click(
|
337 |
reset_states_side_by_side_anony,
|
338 |
states,
|
339 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
340 |
).then(
|
341 |
gen_func,
|
342 |
states + [imagebox] + model_selectors,
|
|
|
389 |
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
390 |
|
391 |
with gr.Row():
|
392 |
+
with gr.Column(scale=0.8):
|
393 |
+
gr.Markdown("Select Players:", elem_id="evaldim_markdown")
|
394 |
with gr.Column():
|
395 |
model_selector_left = gr.Dropdown(
|
396 |
choices=model_list,
|
|
|
409 |
)
|
410 |
|
411 |
with gr.Row():
|
412 |
+
with gr.Column(scale=0.8):
|
413 |
+
imagebox = gr.Image(
|
414 |
+
width=512,
|
415 |
+
show_label=False,
|
416 |
+
visible=True,
|
417 |
+
interactive=False, ## only support offline
|
418 |
+
elem_id="input_box",
|
419 |
+
)
|
420 |
+
|
421 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
422 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
423 |
+
plausive_leftvote_btn = gr.Button(
|
424 |
+
value="👈 A is better", visible=False, interactive=False
|
425 |
+
)
|
426 |
+
plausive_rightvote_btn = gr.Button(
|
427 |
+
value="👉 B is better", visible=False, interactive=False
|
428 |
+
)
|
429 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
430 |
+
plausive_bothbad_btn = gr.Button(
|
431 |
+
value="👎 Both are bad", visible=False, interactive=False
|
432 |
+
)
|
433 |
+
|
434 |
+
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
435 |
+
with gr.Row(elem_id="Geometry Quality"):
|
436 |
+
geo_leftvote_btn = gr.Button(
|
437 |
+
value="👈 A is better", visible=False, interactive=False
|
438 |
+
)
|
439 |
+
geo_rightvote_btn = gr.Button(
|
440 |
+
value="👉 B is better", visible=False, interactive=False
|
441 |
+
)
|
442 |
+
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
443 |
+
geo_bothbad_btn = gr.Button(
|
444 |
+
value="👎 Both are bad", visible=False, interactive=False
|
445 |
+
)
|
446 |
+
|
447 |
+
text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
448 |
+
with gr.Row(elem_id="Texture Quality"):
|
449 |
+
text_leftvote_btn = gr.Button(
|
450 |
+
value="👈 A is better", visible=False, interactive=False
|
451 |
+
)
|
452 |
+
text_rightvote_btn = gr.Button(
|
453 |
+
value="👉 B is better", visible=False, interactive=False
|
454 |
+
)
|
455 |
+
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
456 |
+
text_bothbad_btn = gr.Button(
|
457 |
+
value="👎 Both are bad", visible=False, interactive=False
|
458 |
+
)
|
459 |
+
|
460 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
461 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
462 |
+
coherence_leftvote_btn = gr.Button(
|
463 |
+
value="👈 A is better", visible=False, interactive=False
|
464 |
+
)
|
465 |
+
coherence_rightvote_btn = gr.Button(
|
466 |
+
value="👉 B is better", visible=False, interactive=False
|
467 |
+
)
|
468 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
469 |
+
coherence_bothbad_btn = gr.Button(
|
470 |
+
value="👎 Both are bad", visible=False, interactive=False
|
471 |
+
)
|
472 |
+
|
473 |
+
align_md = gr.Markdown("Visual Alignment: ", visible=False, elem_id="evaldim_markdown")
|
474 |
+
with gr.Row(elem_id="Visual Alignment"):
|
475 |
+
align_leftvote_btn = gr.Button(
|
476 |
+
value="👈 A is better", visible=False, interactive=False
|
477 |
+
)
|
478 |
+
align_rightvote_btn = gr.Button(
|
479 |
+
value="👉 B is better", visible=False, interactive=False
|
480 |
+
)
|
481 |
+
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
482 |
+
align_bothbad_btn = gr.Button(
|
483 |
+
value="👎 Both are bad", visible=False, interactive=False
|
484 |
+
)
|
485 |
+
|
486 |
+
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
487 |
|
488 |
with gr.Column():
|
489 |
normal_left = gr.Image(width=512, label = "Normal A", show_download_button=True)
|
|
|
492 |
normal_right = gr.Image(width=512, label = "Normal B", show_download_button=True,)
|
493 |
rgb_right = gr.Image(width=512, label = "RGB B", show_download_button=True,)
|
494 |
|
495 |
+
# with gr.Row(elem_id="Geometry Plausibility"):
|
496 |
+
# plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
497 |
+
# plausive_leftvote_btn = gr.Button(
|
498 |
+
# value="👈 A is better", visible=False, interactive=False
|
499 |
+
# )
|
500 |
+
# plausive_rightvote_btn = gr.Button(
|
501 |
+
# value="👉 B is better", visible=False, interactive=False
|
502 |
+
# )
|
503 |
+
# plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
504 |
+
# plausive_bothbad_btn = gr.Button(
|
505 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
506 |
+
# )
|
507 |
+
|
508 |
+
# with gr.Row(elem_id="Geometry Quality"):
|
509 |
+
# geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
510 |
+
# geo_leftvote_btn = gr.Button(
|
511 |
+
# value="👈 A is better", visible=False, interactive=False
|
512 |
+
# )
|
513 |
+
# geo_rightvote_btn = gr.Button(
|
514 |
+
# value="👉 B is better", visible=False, interactive=False
|
515 |
+
# )
|
516 |
+
# geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
517 |
+
# geo_bothbad_btn = gr.Button(
|
518 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
519 |
+
# )
|
520 |
+
|
521 |
+
# with gr.Row(elem_id="Texture Quality"):
|
522 |
+
# text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
523 |
+
# text_leftvote_btn = gr.Button(
|
524 |
+
# value="👈 A is better", visible=False, interactive=False
|
525 |
+
# )
|
526 |
+
# text_rightvote_btn = gr.Button(
|
527 |
+
# value="👉 B is better", visible=False, interactive=False
|
528 |
+
# )
|
529 |
+
# text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
530 |
+
# text_bothbad_btn = gr.Button(
|
531 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
532 |
+
# )
|
533 |
|
534 |
+
# with gr.Row(elem_id="Geometry-Texture Coherency"):
|
535 |
+
# coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
536 |
+
# coherence_leftvote_btn = gr.Button(
|
537 |
+
# value="👈 A is better", visible=False, interactive=False
|
538 |
+
# )
|
539 |
+
# coherence_rightvote_btn = gr.Button(
|
540 |
+
# value="👉 B is better", visible=False, interactive=False
|
541 |
+
# )
|
542 |
+
# coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
543 |
+
# coherence_bothbad_btn = gr.Button(
|
544 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
545 |
+
# )
|
546 |
+
|
547 |
+
# with gr.Row(elem_id="Visual Alignment"):
|
548 |
+
# align_md = gr.Markdown("Visual Alignment: ", visible=False, elem_id="evaldim_markdown")
|
549 |
+
# align_leftvote_btn = gr.Button(
|
550 |
+
# value="👈 A is better", visible=False, interactive=False
|
551 |
+
# )
|
552 |
+
# align_rightvote_btn = gr.Button(
|
553 |
+
# value="👉 B is better", visible=False, interactive=False
|
554 |
+
# )
|
555 |
+
# align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
556 |
+
# align_bothbad_btn = gr.Button(
|
557 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
558 |
+
# )
|
|
|
559 |
|
560 |
with gr.Row():
|
561 |
+
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
562 |
+
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
563 |
+
share_btn = gr.Button(value="📷 Share")
|
564 |
+
send_btn = gr.Button(value="📤 Send", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
|
566 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
567 |
|
|
|
636 |
states + model_selectors,
|
637 |
states + [imagebox],
|
638 |
api_name="sample_btn_named"
|
639 |
+
).then(
|
640 |
+
reset_states_side_by_side,
|
641 |
+
states,
|
642 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
643 |
)
|
644 |
|
645 |
imagebox.upload(
|
646 |
reset_states_side_by_side,
|
647 |
states,
|
648 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
649 |
).then(
|
650 |
gen_func,
|
651 |
states + [imagebox] + model_selectors,
|
|
|
664 |
send_btn.click(
|
665 |
reset_states_side_by_side,
|
666 |
states,
|
667 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
668 |
).then(
|
669 |
gen_func,
|
670 |
states + [imagebox] + model_selectors,
|
|
|
698 |
regenerate_btn.click(
|
699 |
reset_states_side_by_side,
|
700 |
states,
|
701 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
702 |
).then(
|
703 |
gen_func,
|
704 |
states + [imagebox] + model_selectors,
|
|
|
748 |
)
|
749 |
|
750 |
with gr.Row():
|
751 |
+
with gr.Column():
|
752 |
+
imagebox = gr.Image(
|
753 |
+
show_label=False,
|
754 |
+
visible=True,
|
755 |
+
interactive=False, ## only support offline
|
756 |
+
elem_id="input_box",
|
757 |
+
label="Prompt",
|
758 |
+
)
|
759 |
+
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
760 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
761 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
762 |
|
|
|
792 |
|
793 |
|
794 |
with gr.Row():
|
795 |
+
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
796 |
+
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
797 |
+
send_btn = gr.Button(value="📤 Send", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
|
799 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
800 |
|
|
|
844 |
[state, model_selector],
|
845 |
[state, imagebox],
|
846 |
api_name="sample_btn_single"
|
847 |
+
).then(
|
848 |
+
reset_state,
|
849 |
+
state,
|
850 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
851 |
)
|
852 |
|
853 |
imagebox.upload(
|
854 |
reset_state,
|
855 |
state,
|
856 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
857 |
).then(
|
858 |
gen_func,
|
859 |
[state, imagebox, model_selector],
|
|
|
869 |
send_btn.click(
|
870 |
reset_state,
|
871 |
state,
|
872 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
873 |
).then(
|
874 |
gen_func,
|
875 |
[state, imagebox, model_selector],
|
|
|
897 |
regenerate_btn.click(
|
898 |
reset_state,
|
899 |
state,
|
900 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
901 |
).then(
|
902 |
gen_func,
|
903 |
[state, imagebox, model_selector],
|
serve/gradio_web_t2i_anony.py
DELETED
@@ -1,225 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
from functools import partial
|
3 |
-
|
4 |
-
from .utils import *
|
5 |
-
from .vote_utils import (
|
6 |
-
upvote_last_response_t2s as upvote_last_response,
|
7 |
-
downvote_last_response_t2s as downvote_last_response,
|
8 |
-
flag_last_response_t2s as flag_last_response,
|
9 |
-
leftvote_last_response_t2s_multi as leftvote_last_response,
|
10 |
-
rightvote_last_response_t2s_multi as rightvote_last_response,
|
11 |
-
tievote_last_response_t2s_multi as tievote_last_response,
|
12 |
-
bothbad_vote_last_response_t2s_multi as bothbad_vote_last_response,
|
13 |
-
share_click_t2s_multi as share_click,
|
14 |
-
share_js
|
15 |
-
)
|
16 |
-
from .inference import(
|
17 |
-
sample_model,
|
18 |
-
sample_prompt,
|
19 |
-
generate_t2s,
|
20 |
-
generate_t2s_multi,
|
21 |
-
generate_t2s_multi_annoy
|
22 |
-
)
|
23 |
-
from constants import TEXT_PROMPT_PATH
|
24 |
-
|
25 |
-
with open(TEXT_PROMPT_PATH, 'r') as f:
|
26 |
-
prompt_list = json.load(f)
|
27 |
-
|
28 |
-
def build_side_by_side_ui_anony(models):
|
29 |
-
notice_markdown = """
|
30 |
-
# ⚔️ GenAI-Arena ⚔️ : Benchmarking Text-to-3D generative models
|
31 |
-
## 📜 Rules
|
32 |
-
- Input prompt to two anonymous models in same area and vote for the better one!
|
33 |
-
- When the results are ready, click the button below to vote.
|
34 |
-
- Vote won't be counted if model identity is revealed during conversation.
|
35 |
-
- Click "Clear" to start a new round.
|
36 |
-
|
37 |
-
## 🏆 Arena Elo
|
38 |
-
Find out who is the 🥇conditional image generation models! More models are going to be supported.
|
39 |
-
|
40 |
-
## 👇 Generating now!
|
41 |
-
|
42 |
-
"""
|
43 |
-
model_list = models.get_t2s_models()
|
44 |
-
gen_func = partial(generate_t2s_multi_annoy, models.inference_parallel_anony, models.render_parallel)
|
45 |
-
|
46 |
-
state_0 = gr.State()
|
47 |
-
state_1 = gr.State()
|
48 |
-
|
49 |
-
gr.Markdown(notice_markdown, elem_id="notice_markdown")
|
50 |
-
|
51 |
-
with gr.Group(elem_id="share-region-anony"):
|
52 |
-
with gr.Accordion("🔍 Expand to see all Arena players", open=False):
|
53 |
-
model_description_md = get_model_description_md(model_list)
|
54 |
-
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
55 |
-
with gr.Row():
|
56 |
-
with gr.Column():
|
57 |
-
normal_left = gr.Image(width=512, label = "Model A", show_copy_button=True)
|
58 |
-
rgb_left = gr.Image(width=512, label = "Model A", show_copy_button=True)
|
59 |
-
with gr.Column():
|
60 |
-
normal_right = gr.Image(width=512, label = "Model B", show_copy_button=True,)
|
61 |
-
rgb_right = gr.Image(width=512, label = "Model B", show_copy_button=True,)
|
62 |
-
|
63 |
-
with gr.Row():
|
64 |
-
with gr.Column():
|
65 |
-
model_selector_left =gr.Markdown("", visible=False)
|
66 |
-
with gr.Column():
|
67 |
-
model_selector_right = gr.Markdown("", visible=False)
|
68 |
-
with gr.Row():
|
69 |
-
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
70 |
-
|
71 |
-
with gr.Row(elem_id="Geometry Quality"):
|
72 |
-
geo_leftvote_btn = gr.Button(
|
73 |
-
value="👈 A is better", visible=False, interactive=False
|
74 |
-
)
|
75 |
-
geo_rightvote_btn = gr.Button(
|
76 |
-
value="👉 B is better", visible=False, interactive=False
|
77 |
-
)
|
78 |
-
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
79 |
-
geo_bothbad_btn = gr.Button(
|
80 |
-
value="👎 Both are bad", visible=False, interactive=False
|
81 |
-
)
|
82 |
-
|
83 |
-
with gr.Row(elem_id="Texture Quality"):
|
84 |
-
text_leftvote_btn = gr.Button(
|
85 |
-
value="👈 A is better", visible=False, interactive=False
|
86 |
-
)
|
87 |
-
text_rightvote_btn = gr.Button(
|
88 |
-
value="👉 B is better", visible=False, interactive=False
|
89 |
-
)
|
90 |
-
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
91 |
-
text_bothbad_btn = gr.Button(
|
92 |
-
value="👎 Both are bad", visible=False, interactive=False
|
93 |
-
)
|
94 |
-
|
95 |
-
with gr.Row(elem_id="Alignment Quality"):
|
96 |
-
align_leftvote_btn = gr.Button(
|
97 |
-
value="👈 A is better", visible=False, interactive=False
|
98 |
-
)
|
99 |
-
align_rightvote_btn = gr.Button(
|
100 |
-
value="👉 B is better", visible=False, interactive=False
|
101 |
-
)
|
102 |
-
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
103 |
-
align_bothbad_btn = gr.Button(
|
104 |
-
value="👎 Both are bad", visible=False, interactive=False
|
105 |
-
)
|
106 |
-
|
107 |
-
with gr.Row():
|
108 |
-
textbox = gr.Textbox(
|
109 |
-
show_label=False,
|
110 |
-
placeholder="👉 Enter your prompt or Sample a random prompt, and press ENTER",
|
111 |
-
container=True,
|
112 |
-
elem_id="input_box",
|
113 |
-
)
|
114 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary", scale=0)
|
115 |
-
send_btn = gr.Button(value="📤 Send", variant="primary", scale=0)
|
116 |
-
|
117 |
-
with gr.Row():
|
118 |
-
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
119 |
-
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
120 |
-
share_btn = gr.Button(value="📷 Share")
|
121 |
-
|
122 |
-
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
123 |
-
|
124 |
-
|
125 |
-
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
126 |
-
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
127 |
-
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
128 |
-
states = [state_0, state_1]
|
129 |
-
model_selectors = [model_selector_left, model_selector_right]
|
130 |
-
results = [normal_left, rgb_left, normal_right, rgb_right]
|
131 |
-
|
132 |
-
for btn_list in [geo_btn_list, text_btn_list, align_btn_list]:
|
133 |
-
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
134 |
-
|
135 |
-
leftvote_btn.click(
|
136 |
-
leftvote_last_response,
|
137 |
-
states + model_selectors,
|
138 |
-
[textbox] + btn_list + model_selectors
|
139 |
-
)
|
140 |
-
rightvote_btn.click(
|
141 |
-
rightvote_last_response,
|
142 |
-
states + model_selectors,
|
143 |
-
[textbox] + btn_list + model_selectors
|
144 |
-
)
|
145 |
-
tie_btn.click(
|
146 |
-
tievote_last_response,
|
147 |
-
states + model_selectors,
|
148 |
-
[textbox] + btn_list + model_selectors
|
149 |
-
)
|
150 |
-
bothbad_btn.click(
|
151 |
-
bothbad_vote_last_response,
|
152 |
-
states + model_selectors,
|
153 |
-
[textbox] + btn_list + model_selectors
|
154 |
-
)
|
155 |
-
|
156 |
-
sample_btn.click(
|
157 |
-
sample_prompt,
|
158 |
-
states + model_selectors + [prompt_list],
|
159 |
-
states + [textbox],
|
160 |
-
api_name="sample_btn_anony"
|
161 |
-
)
|
162 |
-
|
163 |
-
textbox.submit(
|
164 |
-
sample_model,
|
165 |
-
states + [model_list, False],
|
166 |
-
states + model_selectors
|
167 |
-
).then(
|
168 |
-
gen_func,
|
169 |
-
states + [textbox] + model_selectors + [prompt_list],
|
170 |
-
states + results + model_selectors,
|
171 |
-
api_name="submit_btn_anony"
|
172 |
-
).then(
|
173 |
-
enable_buttons_side_by_side,
|
174 |
-
None,
|
175 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
176 |
-
)
|
177 |
-
|
178 |
-
send_btn.click(
|
179 |
-
sample_model,
|
180 |
-
states + [model_list, False],
|
181 |
-
states + model_selectors
|
182 |
-
).then(
|
183 |
-
gen_func,
|
184 |
-
states + [textbox] + model_selectors + [prompt_list],
|
185 |
-
states + results + model_selectors,
|
186 |
-
api_name="send_btn_anony"
|
187 |
-
).then(
|
188 |
-
enable_buttons_side_by_side,
|
189 |
-
None,
|
190 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
191 |
-
)
|
192 |
-
|
193 |
-
clear_btn.click(
|
194 |
-
clear_history_side_by_side_anony,
|
195 |
-
None,
|
196 |
-
states + [textbox] + results + model_selectors,
|
197 |
-
api_name="clear_btn_anony"
|
198 |
-
).then(
|
199 |
-
disable_buttons_side_by_side,
|
200 |
-
None,
|
201 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
202 |
-
)
|
203 |
-
|
204 |
-
regenerate_btn.click(
|
205 |
-
sample_model,
|
206 |
-
states + [model_list, False],
|
207 |
-
states + model_selectors
|
208 |
-
).then(
|
209 |
-
gen_func,
|
210 |
-
states + [textbox] + model_selectors + [prompt_list],
|
211 |
-
states + results + model_selectors,
|
212 |
-
api_name="regenerate_btn_anony"
|
213 |
-
).then(
|
214 |
-
enable_buttons_side_by_side,
|
215 |
-
None,
|
216 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
217 |
-
)
|
218 |
-
|
219 |
-
share_btn.click(
|
220 |
-
share_click,
|
221 |
-
states + model_selectors,
|
222 |
-
[],
|
223 |
-
js=share_js
|
224 |
-
)
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serve/gradio_web_t2i_named.py
DELETED
@@ -1,236 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
from functools import partial
|
3 |
-
|
4 |
-
from .utils import *
|
5 |
-
from .vote_utils import (
|
6 |
-
upvote_last_response_t2s as upvote_last_response,
|
7 |
-
downvote_last_response_t2s as downvote_last_response,
|
8 |
-
flag_last_response_t2s as flag_last_response,
|
9 |
-
leftvote_last_response_t2s_multi as leftvote_last_response,
|
10 |
-
rightvote_last_response_t2s_multi as rightvote_last_response,
|
11 |
-
tievote_last_response_t2s_multi as tievote_last_response,
|
12 |
-
bothbad_vote_last_response_t2s_multi as bothbad_vote_last_response,
|
13 |
-
share_click_t2s_multi as share_click,
|
14 |
-
share_js
|
15 |
-
)
|
16 |
-
from .inference import(
|
17 |
-
sample_prompt,
|
18 |
-
generate_t2s_multi
|
19 |
-
)
|
20 |
-
from constants import TEXT_PROMPT_PATH
|
21 |
-
|
22 |
-
with open(TEXT_PROMPT_PATH, 'r') as f:
|
23 |
-
prompt_list = json.load(f)
|
24 |
-
|
25 |
-
def build_side_by_side_ui_named(models):
|
26 |
-
notice_markdown = """
|
27 |
-
# ⚔️ GenAI-Arena ⚔️ : Benchmarking Text-to-3D generative models
|
28 |
-
## 📜 Rules
|
29 |
-
- Generate with any two selected models side-by-side and vote!
|
30 |
-
- Sample or Input prompt you want to generate.
|
31 |
-
- Click "Send" to submit the prompt.
|
32 |
-
- Click "Clear" to start a new round.
|
33 |
-
|
34 |
-
## 🏆 Arena Elo
|
35 |
-
Find out who is the 🥇conditional image generation models! More models are going to be supported.
|
36 |
-
|
37 |
-
## 👇 Generating now!
|
38 |
-
|
39 |
-
"""
|
40 |
-
model_list = models.get_t2s_models()
|
41 |
-
gen_func = partial(generate_t2s_multi, models.inference_parallel, models.render_parallel)
|
42 |
-
|
43 |
-
state_0 = gr.State()
|
44 |
-
state_1 = gr.State()
|
45 |
-
|
46 |
-
gr.Markdown(notice_markdown, elem_id="notice_markdown")
|
47 |
-
|
48 |
-
with gr.Group(elem_id="share-region-named"):
|
49 |
-
with gr.Row():
|
50 |
-
with gr.Column():
|
51 |
-
model_selector_left = gr.Dropdown(
|
52 |
-
choices=model_list,
|
53 |
-
value=model_list[0] if len(model_list) > 0 else "",
|
54 |
-
interactive=True,
|
55 |
-
show_label=False,
|
56 |
-
container=False,
|
57 |
-
)
|
58 |
-
with gr.Column():
|
59 |
-
model_selector_right = gr.Dropdown(
|
60 |
-
choices=model_list,
|
61 |
-
value=model_list[1] if len(model_list) > 1 else "",
|
62 |
-
interactive=True,
|
63 |
-
show_label=False,
|
64 |
-
container=False,
|
65 |
-
)
|
66 |
-
|
67 |
-
with gr.Accordion("🔍 Expand to see all Arena players", open=False):
|
68 |
-
model_description_md = get_model_description_md(model_list)
|
69 |
-
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
70 |
-
|
71 |
-
with gr.Row():
|
72 |
-
with gr.Column():
|
73 |
-
normal_left = gr.Image(width=512, label = "Model A", show_copy_button=True)
|
74 |
-
rgb_left = gr.Image(width=512, label = "Model A", show_copy_button=True)
|
75 |
-
with gr.Column():
|
76 |
-
normal_right = gr.Image(width=512, label = "Model B", show_copy_button=True,)
|
77 |
-
rgb_right = gr.Image(width=512, label = "Model B", show_copy_button=True,)
|
78 |
-
|
79 |
-
with gr.Row():
|
80 |
-
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
81 |
-
|
82 |
-
with gr.Row(elem_id="Geometry Quality"):
|
83 |
-
geo_leftvote_btn = gr.Button(
|
84 |
-
value="👈 A is better", visible=False, interactive=False
|
85 |
-
)
|
86 |
-
geo_rightvote_btn = gr.Button(
|
87 |
-
value="👉 B is better", visible=False, interactive=False
|
88 |
-
)
|
89 |
-
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
90 |
-
geo_bothbad_btn = gr.Button(
|
91 |
-
value="👎 Both are bad", visible=False, interactive=False
|
92 |
-
)
|
93 |
-
|
94 |
-
with gr.Row(elem_id="Texture Quality"):
|
95 |
-
text_leftvote_btn = gr.Button(
|
96 |
-
value="👈 A is better", visible=False, interactive=False
|
97 |
-
)
|
98 |
-
text_rightvote_btn = gr.Button(
|
99 |
-
value="👉 B is better", visible=False, interactive=False
|
100 |
-
)
|
101 |
-
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
102 |
-
text_bothbad_btn = gr.Button(
|
103 |
-
value="👎 Both are bad", visible=False, interactive=False
|
104 |
-
)
|
105 |
-
|
106 |
-
with gr.Row(elem_id="Alignment Quality"):
|
107 |
-
align_leftvote_btn = gr.Button(
|
108 |
-
value="👈 A is better", visible=False, interactive=False
|
109 |
-
)
|
110 |
-
align_rightvote_btn = gr.Button(
|
111 |
-
value="👉 B is better", visible=False, interactive=False
|
112 |
-
)
|
113 |
-
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
114 |
-
align_bothbad_btn = gr.Button(
|
115 |
-
value="👎 Both are bad", visible=False, interactive=False
|
116 |
-
)
|
117 |
-
|
118 |
-
with gr.Row():
|
119 |
-
textbox = gr.Textbox(
|
120 |
-
show_label=False,
|
121 |
-
placeholder="👉 Enter your prompt or Sample a random prompt, and press ENTER",
|
122 |
-
container=True,
|
123 |
-
elem_id="input_box",
|
124 |
-
)
|
125 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary", scale=0)
|
126 |
-
send_btn = gr.Button(value="📤 Send", variant="primary", scale=0)
|
127 |
-
|
128 |
-
with gr.Row():
|
129 |
-
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
130 |
-
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
131 |
-
share_btn = gr.Button(value="📷 Share")
|
132 |
-
|
133 |
-
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
134 |
-
|
135 |
-
geo_btn_list = [geo_leftvote_btn, geo_rightvote_btn, geo_tie_btn, geo_bothbad_btn]
|
136 |
-
text_btn_list = [text_leftvote_btn, text_rightvote_btn, text_tie_btn, text_bothbad_btn]
|
137 |
-
align_btn_list = [align_leftvote_btn, align_rightvote_btn, align_tie_btn, align_bothbad_btn]
|
138 |
-
states = [state_0, state_1]
|
139 |
-
model_selectors = [model_selector_left, model_selector_right]
|
140 |
-
results = [normal_left, rgb_left, normal_right, rgb_right]
|
141 |
-
|
142 |
-
model_selector_left.change(
|
143 |
-
clear_history_side_by_side,
|
144 |
-
None,
|
145 |
-
states + [textbox] + results,
|
146 |
-
api_name="model_selector_left"
|
147 |
-
)
|
148 |
-
model_selector_right.change(
|
149 |
-
clear_history_side_by_side,
|
150 |
-
None,
|
151 |
-
states + [textbox] + results,
|
152 |
-
api_name="model_selector_right"
|
153 |
-
)
|
154 |
-
|
155 |
-
for btn_list in [geo_btn_list, text_btn_list, align_btn_list]:
|
156 |
-
leftvote_btn, rightvote_btn, tie_btn, bothbad_btn = btn_list
|
157 |
-
|
158 |
-
leftvote_btn.click(
|
159 |
-
leftvote_last_response,
|
160 |
-
states + model_selectors,
|
161 |
-
[textbox] + btn_list + model_selectors
|
162 |
-
)
|
163 |
-
rightvote_btn.click(
|
164 |
-
rightvote_last_response,
|
165 |
-
states + model_selectors,
|
166 |
-
[textbox] + btn_list + model_selectors
|
167 |
-
)
|
168 |
-
tie_btn.click(
|
169 |
-
tievote_last_response,
|
170 |
-
states + model_selectors,
|
171 |
-
[textbox] + btn_list + model_selectors
|
172 |
-
)
|
173 |
-
bothbad_btn.click(
|
174 |
-
bothbad_vote_last_response,
|
175 |
-
states + model_selectors,
|
176 |
-
[textbox] + btn_list + model_selectors
|
177 |
-
)
|
178 |
-
|
179 |
-
sample_btn.click(
|
180 |
-
sample_prompt,
|
181 |
-
states + model_selectors + [prompt_list],
|
182 |
-
states + [textbox],
|
183 |
-
api_name="sample_btn_named"
|
184 |
-
)
|
185 |
-
|
186 |
-
textbox.then(
|
187 |
-
gen_func,
|
188 |
-
states + [textbox] + model_selectors + [prompt_list],
|
189 |
-
states + results + model_selectors,
|
190 |
-
api_name="submit_btn_named"
|
191 |
-
).then(
|
192 |
-
enable_buttons_side_by_side,
|
193 |
-
None,
|
194 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
195 |
-
)
|
196 |
-
|
197 |
-
send_btn.click(
|
198 |
-
gen_func,
|
199 |
-
states + [textbox] + model_selectors + [prompt_list],
|
200 |
-
states + results + model_selectors,
|
201 |
-
api_name="send_btn_named"
|
202 |
-
).then(
|
203 |
-
enable_buttons_side_by_side,
|
204 |
-
None,
|
205 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
206 |
-
)
|
207 |
-
|
208 |
-
clear_btn.click(
|
209 |
-
clear_history_side_by_side_anony,
|
210 |
-
None,
|
211 |
-
states + [textbox] + results + model_selectors,
|
212 |
-
api_name="clear_btn_named"
|
213 |
-
).then(
|
214 |
-
disable_buttons_side_by_side,
|
215 |
-
None,
|
216 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
217 |
-
)
|
218 |
-
|
219 |
-
regenerate_btn.click(
|
220 |
-
gen_func,
|
221 |
-
states + [textbox] + model_selectors + [prompt_list],
|
222 |
-
states + results + model_selectors,
|
223 |
-
api_name="regenerate_btn_named"
|
224 |
-
).then(
|
225 |
-
enable_buttons_side_by_side,
|
226 |
-
None,
|
227 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
228 |
-
)
|
229 |
-
|
230 |
-
share_btn.click(
|
231 |
-
share_click,
|
232 |
-
states + model_selectors,
|
233 |
-
[],
|
234 |
-
js=share_js
|
235 |
-
)
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serve/gradio_web_t2i_single.py
DELETED
@@ -1,159 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
from functools import partial
|
3 |
-
|
4 |
-
from .utils import *
|
5 |
-
from .vote_utils import (
|
6 |
-
upvote_last_response_t2s as upvote_last_response,
|
7 |
-
downvote_last_response_t2s as downvote_last_response,
|
8 |
-
flag_last_response_t2s as flag_last_response,
|
9 |
-
)
|
10 |
-
from .inference import(
|
11 |
-
sample_prompt,
|
12 |
-
generate_t2s
|
13 |
-
)
|
14 |
-
from constants import TEXT_PROMPT_PATH
|
15 |
-
|
16 |
-
with open(TEXT_PROMPT_PATH, 'r') as f:
|
17 |
-
prompt_list = json.load(f)
|
18 |
-
|
19 |
-
def build_single_model_ui(models):
|
20 |
-
notice_markdown = """
|
21 |
-
# 🏔️ Play with Image Generation Models
|
22 |
-
{promotion}
|
23 |
-
|
24 |
-
## 🤖 Choose any model to generate
|
25 |
-
|
26 |
-
"""
|
27 |
-
model_list = models.get_t2s_models()
|
28 |
-
gen_func = partial(generate_t2s, models.inference_parallel, models.render_parallel)
|
29 |
-
|
30 |
-
gr.Markdown(notice_markdown, elem_id="notice_markdown")
|
31 |
-
|
32 |
-
with gr.Row(elem_id="model_selector_row"):
|
33 |
-
model_selector = gr.Dropdown(
|
34 |
-
choices=model_list,
|
35 |
-
value=model_list[0] if len(model_list) > 0 else "",
|
36 |
-
interactive=True,
|
37 |
-
show_label=False
|
38 |
-
)
|
39 |
-
|
40 |
-
with gr.Row():
|
41 |
-
with gr.Accordion("🔍 Expand to see all Arena players", open=False):
|
42 |
-
model_description_md = get_model_description_md(model_list)
|
43 |
-
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
44 |
-
|
45 |
-
with gr.Row():
|
46 |
-
textbox = gr.Textbox(
|
47 |
-
show_label=False,
|
48 |
-
placeholder="👉 Enter your prompt or Sample a random prompt, and press ENTER",
|
49 |
-
container=True,
|
50 |
-
elem_id="input_box",
|
51 |
-
)
|
52 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary", scale=0)
|
53 |
-
send_btn = gr.Button(value="📤 Send", variant="primary", scale=0)
|
54 |
-
|
55 |
-
with gr.Row():
|
56 |
-
normal = gr.Image(width=512, label = "Normal", show_copy_button=True)
|
57 |
-
rgb = gr.Image(width=512, label = "RGB", show_copy_button=True,)
|
58 |
-
|
59 |
-
with gr.Row():
|
60 |
-
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
61 |
-
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
62 |
-
|
63 |
-
with gr.Row(elem_id="Geometry Quality"):
|
64 |
-
geo_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
65 |
-
geo_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
66 |
-
geo_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
67 |
-
|
68 |
-
with gr.Row(elem_id="Texture Quality"):
|
69 |
-
text_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
70 |
-
text_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
71 |
-
text_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
72 |
-
|
73 |
-
with gr.Row(elem_id="Alignment Quality"):
|
74 |
-
align_upvote_btn = gr.Button(value="👍 Upvote", interactive=False)
|
75 |
-
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
76 |
-
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
77 |
-
|
78 |
-
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
79 |
-
|
80 |
-
state = gr.State()
|
81 |
-
geo_btn_list = [geo_upvote_btn, geo_downvote_btn, geo_flag_btn]
|
82 |
-
text_btn_list = [text_upvote_btn, text_downvote_btn, text_flag_btn]
|
83 |
-
align_btn_list = [align_upvote_btn, align_downvote_btn, align_flag_btn]
|
84 |
-
|
85 |
-
for btn_list in [geo_btn_list, text_btn_list, align_btn_list]:
|
86 |
-
upvote_btn, downvote_btn, flag_btn = btn_list
|
87 |
-
|
88 |
-
upvote_btn.click(
|
89 |
-
upvote_last_response,
|
90 |
-
[state, model_selector],
|
91 |
-
[textbox] + btn_list
|
92 |
-
)
|
93 |
-
|
94 |
-
downvote_btn.click(
|
95 |
-
downvote_last_response,
|
96 |
-
[state, model_selector],
|
97 |
-
[textbox] + btn_list
|
98 |
-
)
|
99 |
-
flag_btn.click(
|
100 |
-
flag_last_response,
|
101 |
-
[state, model_selector],
|
102 |
-
[textbox] + btn_list
|
103 |
-
)
|
104 |
-
|
105 |
-
sample_btn.click(
|
106 |
-
sample_prompt,
|
107 |
-
[state, model_selector, prompt_list],
|
108 |
-
state + [textbox],
|
109 |
-
api_name="sample_btn_single"
|
110 |
-
)
|
111 |
-
|
112 |
-
textbox.submit(
|
113 |
-
gen_func,
|
114 |
-
[state, textbox, model_selector, prompt_list],
|
115 |
-
[state, normal, rgb],
|
116 |
-
api_name="submit_btn_single",
|
117 |
-
show_progress = "full"
|
118 |
-
).then(
|
119 |
-
enable_buttons,
|
120 |
-
None,
|
121 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
122 |
-
)
|
123 |
-
|
124 |
-
send_btn.click(
|
125 |
-
gen_func,
|
126 |
-
[state, textbox, model_selector, prompt_list],
|
127 |
-
[state, normal, rgb],
|
128 |
-
api_name="send_btn_single",
|
129 |
-
show_progress = "full"
|
130 |
-
).then(
|
131 |
-
enable_buttons,
|
132 |
-
None,
|
133 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
134 |
-
)
|
135 |
-
|
136 |
-
clear_btn.click(
|
137 |
-
clear_history,
|
138 |
-
None,
|
139 |
-
[state, textbox, normal, rgb],
|
140 |
-
api_name="clear_history_single",
|
141 |
-
show_progress="full"
|
142 |
-
).then(
|
143 |
-
disable_buttons,
|
144 |
-
None,
|
145 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
146 |
-
)
|
147 |
-
|
148 |
-
regenerate_btn.click(
|
149 |
-
gen_func,
|
150 |
-
[state, textbox, model_selector, prompt_list],
|
151 |
-
[state, normal, rgb],
|
152 |
-
api_name="regenerate_btn_single",
|
153 |
-
show_progress = "full"
|
154 |
-
).then(
|
155 |
-
enable_buttons,
|
156 |
-
None,
|
157 |
-
geo_btn_list + text_btn_list + align_btn_list + [regenerate_btn, clear_btn]
|
158 |
-
)
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serve/gradio_web_t2s.py
CHANGED
@@ -60,13 +60,80 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
60 |
with gr.Column():
|
61 |
textbox = gr.Textbox(
|
62 |
show_label=False,
|
63 |
-
placeholder="👉 Enter your prompt or Sample a random prompt, and press
|
64 |
container=True,
|
65 |
elem_id="input_box",
|
66 |
-
lines =
|
67 |
interactive=False, ## only support offline
|
68 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
|
|
70 |
with gr.Column():
|
71 |
normal_left = gr.Image(width=512, label = "Normal A", show_download_button=True)
|
72 |
rgb_left = gr.Image(width=512, label = "RGB A", show_download_button=True)
|
@@ -76,7 +143,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
76 |
|
77 |
with gr.Row():
|
78 |
with gr.Column():
|
79 |
-
gr.Markdown("", visible=
|
80 |
with gr.Column():
|
81 |
model_selector_left =gr.Markdown("", visible=False)
|
82 |
with gr.Column():
|
@@ -84,70 +151,70 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
84 |
with gr.Row():
|
85 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
86 |
|
87 |
-
with gr.Row(elem_id="Geometry Plausibility"):
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
with gr.Row(elem_id="Geometry Quality"):
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
with gr.Row(elem_id="Texture Quality"):
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
|
126 |
-
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
with gr.Row(elem_id="Semantic Alignment"):
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
)
|
151 |
|
152 |
# with gr.Row():
|
153 |
# textbox = gr.Textbox(
|
@@ -162,8 +229,8 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
162 |
|
163 |
with gr.Row():
|
164 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
165 |
-
share_btn = gr.Button(value="📷 Share")
|
166 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
|
|
167 |
send_btn = gr.Button(value="📤 Send", variant="primary")
|
168 |
|
169 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
@@ -209,12 +276,16 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
209 |
states + model_selectors,
|
210 |
states + [textbox],
|
211 |
api_name="sample_btn_anony"
|
|
|
|
|
|
|
|
|
212 |
)
|
213 |
|
214 |
textbox.submit(
|
215 |
reset_states_side_by_side_anony,
|
216 |
states,
|
217 |
-
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn
|
218 |
).then(
|
219 |
gen_func,
|
220 |
states + [textbox] + model_selectors,
|
@@ -233,7 +304,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
233 |
send_btn.click(
|
234 |
reset_states_side_by_side_anony,
|
235 |
states,
|
236 |
-
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn
|
237 |
).then(
|
238 |
gen_func,
|
239 |
states + [textbox] + model_selectors,
|
@@ -267,7 +338,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
267 |
regenerate_btn.click(
|
268 |
reset_states_side_by_side_anony,
|
269 |
states,
|
270 |
-
states + model_selectors + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
271 |
).then(
|
272 |
gen_func,
|
273 |
states + [textbox] + model_selectors,
|
@@ -320,6 +391,8 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
320 |
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
321 |
|
322 |
with gr.Row():
|
|
|
|
|
323 |
with gr.Column():
|
324 |
model_selector_left = gr.Dropdown(
|
325 |
choices=model_list,
|
@@ -338,6 +411,83 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
338 |
)
|
339 |
|
340 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
with gr.Column():
|
342 |
normal_left = gr.Image(width=512, label = "Normal A", show_download_button=True)
|
343 |
rgb_left = gr.Image(width=512, label = "RGB A", show_download_button=True)
|
@@ -348,86 +498,11 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
348 |
with gr.Row():
|
349 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
350 |
|
351 |
-
with gr.Row(elem_id="Geometry Plausibility"):
|
352 |
-
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
353 |
-
plausive_leftvote_btn = gr.Button(
|
354 |
-
value="👈 A is better", visible=False, interactive=False
|
355 |
-
)
|
356 |
-
plausive_rightvote_btn = gr.Button(
|
357 |
-
value="👉 B is better", visible=False, interactive=False
|
358 |
-
)
|
359 |
-
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
360 |
-
plausive_bothbad_btn = gr.Button(
|
361 |
-
value="👎 Both are bad", visible=False, interactive=False
|
362 |
-
)
|
363 |
-
|
364 |
-
with gr.Row(elem_id="Geometry Quality"):
|
365 |
-
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
366 |
-
geo_leftvote_btn = gr.Button(
|
367 |
-
value="👈 A is better", visible=False, interactive=False
|
368 |
-
)
|
369 |
-
geo_rightvote_btn = gr.Button(
|
370 |
-
value="👉 B is better", visible=False, interactive=False
|
371 |
-
)
|
372 |
-
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
373 |
-
geo_bothbad_btn = gr.Button(
|
374 |
-
value="👎 Both are bad", visible=False, interactive=False
|
375 |
-
)
|
376 |
-
|
377 |
-
with gr.Row(elem_id="Texture Quality"):
|
378 |
-
text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
379 |
-
text_leftvote_btn = gr.Button(
|
380 |
-
value="👈 A is better", visible=False, interactive=False
|
381 |
-
)
|
382 |
-
text_rightvote_btn = gr.Button(
|
383 |
-
value="👉 B is better", visible=False, interactive=False
|
384 |
-
)
|
385 |
-
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
386 |
-
text_bothbad_btn = gr.Button(
|
387 |
-
value="👎 Both are bad", visible=False, interactive=False
|
388 |
-
)
|
389 |
-
|
390 |
-
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
391 |
-
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
392 |
-
coherence_leftvote_btn = gr.Button(
|
393 |
-
value="👈 A is better", visible=False, interactive=False
|
394 |
-
)
|
395 |
-
coherence_rightvote_btn = gr.Button(
|
396 |
-
value="👉 B is better", visible=False, interactive=False
|
397 |
-
)
|
398 |
-
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
399 |
-
coherence_bothbad_btn = gr.Button(
|
400 |
-
value="👎 Both are bad", visible=False, interactive=False
|
401 |
-
)
|
402 |
-
|
403 |
-
with gr.Row(elem_id="Semantic Alignment"):
|
404 |
-
align_md = gr.Markdown("Semantic Alignment: ", visible=False, elem_id="evaldim_markdown")
|
405 |
-
align_leftvote_btn = gr.Button(
|
406 |
-
value="👈 A is better", visible=False, interactive=False
|
407 |
-
)
|
408 |
-
align_rightvote_btn = gr.Button(
|
409 |
-
value="👉 B is better", visible=False, interactive=False
|
410 |
-
)
|
411 |
-
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
412 |
-
align_bothbad_btn = gr.Button(
|
413 |
-
value="👎 Both are bad", visible=False, interactive=False
|
414 |
-
)
|
415 |
-
|
416 |
-
with gr.Row():
|
417 |
-
textbox = gr.Textbox(
|
418 |
-
show_label=False,
|
419 |
-
placeholder="👉 Enter your prompt or Sample a random prompt, and press ENTER",
|
420 |
-
container=True,
|
421 |
-
elem_id="input_box",
|
422 |
-
interactive=False, ## only support offline
|
423 |
-
)
|
424 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary", scale=0)
|
425 |
-
send_btn = gr.Button(value="📤 Send", variant="primary", scale=0)
|
426 |
-
|
427 |
with gr.Row():
|
428 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
429 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
430 |
share_btn = gr.Button(value="📷 Share")
|
|
|
431 |
|
432 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
433 |
|
@@ -502,12 +577,16 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
502 |
states + model_selectors,
|
503 |
states + [textbox],
|
504 |
api_name="sample_btn_named"
|
|
|
|
|
|
|
|
|
505 |
)
|
506 |
|
507 |
textbox.submit(
|
508 |
reset_states_side_by_side,
|
509 |
states,
|
510 |
-
states + vote_btn_list + [regenerate_btn, clear_btn
|
511 |
).then(
|
512 |
gen_func,
|
513 |
states + [textbox] + model_selectors,
|
@@ -526,7 +605,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
526 |
send_btn.click(
|
527 |
reset_states_side_by_side,
|
528 |
states,
|
529 |
-
states + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
530 |
).then(
|
531 |
gen_func,
|
532 |
states + [textbox] + model_selectors,
|
@@ -560,7 +639,7 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
560 |
regenerate_btn.click(
|
561 |
reset_states_side_by_side,
|
562 |
states,
|
563 |
-
states + vote_btn_list + [regenerate_btn, clear_btn
|
564 |
).then(
|
565 |
gen_func,
|
566 |
states + [textbox] + model_selectors,
|
@@ -610,6 +689,16 @@ def build_t2s_ui_single_model(models):
|
|
610 |
)
|
611 |
|
612 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
614 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
615 |
|
@@ -643,20 +732,10 @@ def build_t2s_ui_single_model(models):
|
|
643 |
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
644 |
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
645 |
|
646 |
-
with gr.Row():
|
647 |
-
textbox = gr.Textbox(
|
648 |
-
show_label=False,
|
649 |
-
placeholder="👉 Enter your prompt or Sample a random prompt, and press ENTER",
|
650 |
-
container=True,
|
651 |
-
elem_id="input_box",
|
652 |
-
interactive=False, ## only support offline
|
653 |
-
)
|
654 |
-
sample_btn = gr.Button(value="🎲 Sample", variant="primary", scale=0)
|
655 |
-
send_btn = gr.Button(value="📤 Send", variant="primary", scale=0)
|
656 |
-
|
657 |
with gr.Row():
|
658 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
659 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
|
|
660 |
|
661 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
662 |
|
@@ -706,12 +785,16 @@ def build_t2s_ui_single_model(models):
|
|
706 |
[state, model_selector],
|
707 |
[state, textbox],
|
708 |
api_name="sample_btn_single"
|
|
|
|
|
|
|
|
|
709 |
)
|
710 |
|
711 |
textbox.submit(
|
712 |
reset_state,
|
713 |
state,
|
714 |
-
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
715 |
).then(
|
716 |
gen_func,
|
717 |
[state, textbox, model_selector],
|
@@ -727,7 +810,7 @@ def build_t2s_ui_single_model(models):
|
|
727 |
send_btn.click(
|
728 |
reset_state,
|
729 |
state,
|
730 |
-
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
731 |
).then(
|
732 |
gen_func,
|
733 |
[state, textbox, model_selector],
|
@@ -755,7 +838,7 @@ def build_t2s_ui_single_model(models):
|
|
755 |
regenerate_btn.click(
|
756 |
reset_state,
|
757 |
state,
|
758 |
-
[state] + vote_btn_list + [regenerate_btn, clear_btn]
|
759 |
).then(
|
760 |
gen_func,
|
761 |
[state, textbox, model_selector],
|
|
|
60 |
with gr.Column():
|
61 |
textbox = gr.Textbox(
|
62 |
show_label=False,
|
63 |
+
placeholder="👉 Enter your prompt or Sample a random prompt, and press 'Send'",
|
64 |
container=True,
|
65 |
elem_id="input_box",
|
66 |
+
lines = 15,
|
67 |
interactive=False, ## only support offline
|
68 |
)
|
69 |
+
|
70 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
71 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
72 |
+
plausive_leftvote_btn = gr.Button(
|
73 |
+
value="👈 A is better", visible=False, interactive=False
|
74 |
+
)
|
75 |
+
plausive_rightvote_btn = gr.Button(
|
76 |
+
value="👉 B is better", visible=False, interactive=False
|
77 |
+
)
|
78 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
79 |
+
plausive_bothbad_btn = gr.Button(
|
80 |
+
value="👎 Both are bad", visible=False, interactive=False
|
81 |
+
)
|
82 |
+
|
83 |
+
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
84 |
+
with gr.Row(elem_id="Geometry Quality"):
|
85 |
+
geo_leftvote_btn = gr.Button(
|
86 |
+
value="👈 A is better", visible=False, interactive=False
|
87 |
+
)
|
88 |
+
geo_rightvote_btn = gr.Button(
|
89 |
+
value="👉 B is better", visible=False, interactive=False
|
90 |
+
)
|
91 |
+
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
92 |
+
geo_bothbad_btn = gr.Button(
|
93 |
+
value="👎 Both are bad", visible=False, interactive=False
|
94 |
+
)
|
95 |
+
|
96 |
+
text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
97 |
+
with gr.Row(elem_id="Texture Quality"):
|
98 |
+
text_leftvote_btn = gr.Button(
|
99 |
+
value="👈 A is better", visible=False, interactive=False
|
100 |
+
)
|
101 |
+
text_rightvote_btn = gr.Button(
|
102 |
+
value="👉 B is better", visible=False, interactive=False
|
103 |
+
)
|
104 |
+
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
105 |
+
text_bothbad_btn = gr.Button(
|
106 |
+
value="👎 Both are bad", visible=False, interactive=False
|
107 |
+
)
|
108 |
+
|
109 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
110 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
111 |
+
coherence_leftvote_btn = gr.Button(
|
112 |
+
value="👈 A is better", visible=False, interactive=False
|
113 |
+
)
|
114 |
+
coherence_rightvote_btn = gr.Button(
|
115 |
+
value="👉 B is better", visible=False, interactive=False
|
116 |
+
)
|
117 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
118 |
+
coherence_bothbad_btn = gr.Button(
|
119 |
+
value="👎 Both are bad", visible=False, interactive=False
|
120 |
+
)
|
121 |
+
|
122 |
+
align_md = gr.Markdown("Semantic Alignment: ", visible=False, elem_id="evaldim_markdown")
|
123 |
+
with gr.Row(elem_id="Semantic Alignment"):
|
124 |
+
align_leftvote_btn = gr.Button(
|
125 |
+
value="👈 A is better", visible=False, interactive=False
|
126 |
+
)
|
127 |
+
align_rightvote_btn = gr.Button(
|
128 |
+
value="👉 B is better", visible=False, interactive=False
|
129 |
+
)
|
130 |
+
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
131 |
+
align_bothbad_btn = gr.Button(
|
132 |
+
value="👎 Both are bad", visible=False, interactive=False
|
133 |
+
)
|
134 |
+
|
135 |
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
136 |
+
|
137 |
with gr.Column():
|
138 |
normal_left = gr.Image(width=512, label = "Normal A", show_download_button=True)
|
139 |
rgb_left = gr.Image(width=512, label = "RGB A", show_download_button=True)
|
|
|
143 |
|
144 |
with gr.Row():
|
145 |
with gr.Column():
|
146 |
+
gr.Markdown("", visible=False)
|
147 |
with gr.Column():
|
148 |
model_selector_left =gr.Markdown("", visible=False)
|
149 |
with gr.Column():
|
|
|
151 |
with gr.Row():
|
152 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
153 |
|
154 |
+
# with gr.Row(elem_id="Geometry Plausibility"):
|
155 |
+
# plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
156 |
+
# plausive_leftvote_btn = gr.Button(
|
157 |
+
# value="👈 A is better", visible=False, interactive=False
|
158 |
+
# )
|
159 |
+
# plausive_rightvote_btn = gr.Button(
|
160 |
+
# value="👉 B is better", visible=False, interactive=False
|
161 |
+
# )
|
162 |
+
# plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
163 |
+
# plausive_bothbad_btn = gr.Button(
|
164 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
165 |
+
# )
|
166 |
+
|
167 |
+
# with gr.Row(elem_id="Geometry Quality"):
|
168 |
+
# geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
169 |
+
# geo_leftvote_btn = gr.Button(
|
170 |
+
# value="👈 A is better", visible=False, interactive=False
|
171 |
+
# )
|
172 |
+
# geo_rightvote_btn = gr.Button(
|
173 |
+
# value="👉 B is better", visible=False, interactive=False
|
174 |
+
# )
|
175 |
+
# geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
176 |
+
# geo_bothbad_btn = gr.Button(
|
177 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
178 |
+
# )
|
179 |
+
|
180 |
+
# with gr.Row(elem_id="Texture Quality"):
|
181 |
+
# text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
182 |
+
# text_leftvote_btn = gr.Button(
|
183 |
+
# value="👈 A is better", visible=False, interactive=False
|
184 |
+
# )
|
185 |
+
# text_rightvote_btn = gr.Button(
|
186 |
+
# value="👉 B is better", visible=False, interactive=False
|
187 |
+
# )
|
188 |
+
# text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
189 |
+
# text_bothbad_btn = gr.Button(
|
190 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
191 |
+
# )
|
192 |
|
193 |
+
# with gr.Row(elem_id="Geometry-Texture Coherency"):
|
194 |
+
# coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
195 |
+
# coherence_leftvote_btn = gr.Button(
|
196 |
+
# value="👈 A is better", visible=False, interactive=False
|
197 |
+
# )
|
198 |
+
# coherence_rightvote_btn = gr.Button(
|
199 |
+
# value="👉 B is better", visible=False, interactive=False
|
200 |
+
# )
|
201 |
+
# coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
202 |
+
# coherence_bothbad_btn = gr.Button(
|
203 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
204 |
+
# )
|
205 |
+
|
206 |
+
# with gr.Row(elem_id="Semantic Alignment"):
|
207 |
+
# align_md = gr.Markdown("Semantic Alignment: ", visible=False, elem_id="evaldim_markdown")
|
208 |
+
# align_leftvote_btn = gr.Button(
|
209 |
+
# value="👈 A is better", visible=False, interactive=False
|
210 |
+
# )
|
211 |
+
# align_rightvote_btn = gr.Button(
|
212 |
+
# value="👉 B is better", visible=False, interactive=False
|
213 |
+
# )
|
214 |
+
# align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
215 |
+
# align_bothbad_btn = gr.Button(
|
216 |
+
# value="👎 Both are bad", visible=False, interactive=False
|
217 |
+
# )
|
218 |
|
219 |
# with gr.Row():
|
220 |
# textbox = gr.Textbox(
|
|
|
229 |
|
230 |
with gr.Row():
|
231 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
|
|
232 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
233 |
+
share_btn = gr.Button(value="📷 Share")
|
234 |
send_btn = gr.Button(value="📤 Send", variant="primary")
|
235 |
|
236 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
|
|
276 |
states + model_selectors,
|
277 |
states + [textbox],
|
278 |
api_name="sample_btn_anony"
|
279 |
+
).then(
|
280 |
+
reset_states_side_by_side_anony,
|
281 |
+
states,
|
282 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
283 |
)
|
284 |
|
285 |
textbox.submit(
|
286 |
reset_states_side_by_side_anony,
|
287 |
states,
|
288 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
289 |
).then(
|
290 |
gen_func,
|
291 |
states + [textbox] + model_selectors,
|
|
|
304 |
send_btn.click(
|
305 |
reset_states_side_by_side_anony,
|
306 |
states,
|
307 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
308 |
).then(
|
309 |
gen_func,
|
310 |
states + [textbox] + model_selectors,
|
|
|
338 |
regenerate_btn.click(
|
339 |
reset_states_side_by_side_anony,
|
340 |
states,
|
341 |
+
states + model_selectors + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
342 |
).then(
|
343 |
gen_func,
|
344 |
states + [textbox] + model_selectors,
|
|
|
391 |
gr.Markdown(model_description_md, elem_id="model_description_markdown")
|
392 |
|
393 |
with gr.Row():
|
394 |
+
with gr.Column():
|
395 |
+
gr.Markdown("Select Players:", elem_id="evaldim_markdown")
|
396 |
with gr.Column():
|
397 |
model_selector_left = gr.Dropdown(
|
398 |
choices=model_list,
|
|
|
411 |
)
|
412 |
|
413 |
with gr.Row():
|
414 |
+
with gr.Column():
|
415 |
+
textbox = gr.Textbox(
|
416 |
+
show_label=False,
|
417 |
+
placeholder="👉 Enter your prompt or Sample a random prompt, and press 'Send'",
|
418 |
+
container=True,
|
419 |
+
elem_id="input_box",
|
420 |
+
lines=15,
|
421 |
+
interactive=False, ## only support offline
|
422 |
+
)
|
423 |
+
|
424 |
+
plausive_md = gr.Markdown("Geometry Plausibility: ", visible=False, elem_id="evaldim_markdown")
|
425 |
+
with gr.Row(elem_id="Geometry Plausibility"):
|
426 |
+
plausive_leftvote_btn = gr.Button(
|
427 |
+
value="👈 A is better", visible=False, interactive=False
|
428 |
+
)
|
429 |
+
plausive_rightvote_btn = gr.Button(
|
430 |
+
value="👉 B is better", visible=False, interactive=False
|
431 |
+
)
|
432 |
+
plausive_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
433 |
+
plausive_bothbad_btn = gr.Button(
|
434 |
+
value="👎 Both are bad", visible=False, interactive=False
|
435 |
+
)
|
436 |
+
|
437 |
+
geo_md = gr.Markdown("Geometry Quality: ", visible=False, elem_id="evaldim_markdown")
|
438 |
+
with gr.Row(elem_id="Geometry Quality"):
|
439 |
+
geo_leftvote_btn = gr.Button(
|
440 |
+
value="👈 A is better", visible=False, interactive=False
|
441 |
+
)
|
442 |
+
geo_rightvote_btn = gr.Button(
|
443 |
+
value="👉 B is better", visible=False, interactive=False
|
444 |
+
)
|
445 |
+
geo_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
446 |
+
geo_bothbad_btn = gr.Button(
|
447 |
+
value="👎 Both are bad", visible=False, interactive=False
|
448 |
+
)
|
449 |
+
|
450 |
+
text_md = gr.Markdown("Texture Quality: ", visible=False, elem_id="evaldim_markdown")
|
451 |
+
with gr.Row(elem_id="Texture Quality"):
|
452 |
+
text_leftvote_btn = gr.Button(
|
453 |
+
value="👈 A is better", visible=False, interactive=False
|
454 |
+
)
|
455 |
+
text_rightvote_btn = gr.Button(
|
456 |
+
value="👉 B is better", visible=False, interactive=False
|
457 |
+
)
|
458 |
+
text_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
459 |
+
text_bothbad_btn = gr.Button(
|
460 |
+
value="👎 Both are bad", visible=False, interactive=False
|
461 |
+
)
|
462 |
+
|
463 |
+
coherence_md = gr.Markdown("Geometry-Texture Coherency: ", visible=False, elem_id="evaldim_markdown")
|
464 |
+
with gr.Row(elem_id="Geometry-Texture Coherency"):
|
465 |
+
coherence_leftvote_btn = gr.Button(
|
466 |
+
value="👈 A is better", visible=False, interactive=False
|
467 |
+
)
|
468 |
+
coherence_rightvote_btn = gr.Button(
|
469 |
+
value="👉 B is better", visible=False, interactive=False
|
470 |
+
)
|
471 |
+
coherence_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
472 |
+
coherence_bothbad_btn = gr.Button(
|
473 |
+
value="👎 Both are bad", visible=False, interactive=False
|
474 |
+
)
|
475 |
+
|
476 |
+
align_md = gr.Markdown("Semantic Alignment: ", visible=False, elem_id="evaldim_markdown")
|
477 |
+
with gr.Row(elem_id="Semantic Alignment"):
|
478 |
+
align_leftvote_btn = gr.Button(
|
479 |
+
value="👈 A is better", visible=False, interactive=False
|
480 |
+
)
|
481 |
+
align_rightvote_btn = gr.Button(
|
482 |
+
value="👉 B is better", visible=False, interactive=False
|
483 |
+
)
|
484 |
+
align_tie_btn = gr.Button(value="🤝 Tie", visible=False, interactive=False)
|
485 |
+
align_bothbad_btn = gr.Button(
|
486 |
+
value="👎 Both are bad", visible=False, interactive=False
|
487 |
+
)
|
488 |
+
|
489 |
+
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
490 |
+
|
491 |
with gr.Column():
|
492 |
normal_left = gr.Image(width=512, label = "Normal A", show_download_button=True)
|
493 |
rgb_left = gr.Image(width=512, label = "RGB A", show_download_button=True)
|
|
|
498 |
with gr.Row():
|
499 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
with gr.Row():
|
502 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
503 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
504 |
share_btn = gr.Button(value="📷 Share")
|
505 |
+
send_btn = gr.Button(value="📤 Send", variant="primary")
|
506 |
|
507 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
508 |
|
|
|
577 |
states + model_selectors,
|
578 |
states + [textbox],
|
579 |
api_name="sample_btn_named"
|
580 |
+
).then(
|
581 |
+
reset_states_side_by_side,
|
582 |
+
states,
|
583 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
584 |
)
|
585 |
|
586 |
textbox.submit(
|
587 |
reset_states_side_by_side,
|
588 |
states,
|
589 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
590 |
).then(
|
591 |
gen_func,
|
592 |
states + [textbox] + model_selectors,
|
|
|
605 |
send_btn.click(
|
606 |
reset_states_side_by_side,
|
607 |
states,
|
608 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
609 |
).then(
|
610 |
gen_func,
|
611 |
states + [textbox] + model_selectors,
|
|
|
639 |
regenerate_btn.click(
|
640 |
reset_states_side_by_side,
|
641 |
states,
|
642 |
+
states + results + vote_btn_list + [regenerate_btn, clear_btn] + dim_md_list
|
643 |
).then(
|
644 |
gen_func,
|
645 |
states + [textbox] + model_selectors,
|
|
|
689 |
)
|
690 |
|
691 |
with gr.Row():
|
692 |
+
with gr.Column():
|
693 |
+
textbox = gr.Textbox(
|
694 |
+
show_label=False,
|
695 |
+
placeholder="👉 Enter your prompt or Sample a random prompt, and press 'Send'",
|
696 |
+
container=True,
|
697 |
+
elem_id="input_box",
|
698 |
+
lines=15,
|
699 |
+
interactive=False, ## only support offline
|
700 |
+
)
|
701 |
+
sample_btn = gr.Button(value="🎲 Sample", variant="primary")
|
702 |
normal = gr.Image(width=512, label = "Normal", show_download_button=True)
|
703 |
rgb = gr.Image(width=512, label = "RGB", show_download_button=True,)
|
704 |
|
|
|
732 |
align_downvote_btn = gr.Button(value="👎 Downvote", interactive=False)
|
733 |
align_flag_btn = gr.Button(value="⚠️ Flag", interactive=False)
|
734 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
with gr.Row():
|
736 |
clear_btn = gr.Button(value="🗑️ Clear", interactive=False)
|
737 |
regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False)
|
738 |
+
send_btn = gr.Button(value="📤 Send", variant="primary")
|
739 |
|
740 |
gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
|
741 |
|
|
|
785 |
[state, model_selector],
|
786 |
[state, textbox],
|
787 |
api_name="sample_btn_single"
|
788 |
+
).then(
|
789 |
+
reset_state,
|
790 |
+
state,
|
791 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
792 |
)
|
793 |
|
794 |
textbox.submit(
|
795 |
reset_state,
|
796 |
state,
|
797 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
798 |
).then(
|
799 |
gen_func,
|
800 |
[state, textbox, model_selector],
|
|
|
810 |
send_btn.click(
|
811 |
reset_state,
|
812 |
state,
|
813 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
814 |
).then(
|
815 |
gen_func,
|
816 |
[state, textbox, model_selector],
|
|
|
838 |
regenerate_btn.click(
|
839 |
reset_state,
|
840 |
state,
|
841 |
+
[state, normal, rgb] + vote_btn_list + [regenerate_btn, clear_btn]
|
842 |
).then(
|
843 |
gen_func,
|
844 |
[state, textbox, model_selector],
|
serve/inference.py
CHANGED
@@ -4,20 +4,12 @@ import time
|
|
4 |
|
5 |
from .utils import *
|
6 |
from .vote_utils import t2s_logger, t2s_multi_logger, i2s_logger, i2s_multi_logger
|
7 |
-
from constants import IMAGE_DIR,
|
8 |
|
9 |
with open(TEXT_PROMPT_PATH, 'r') as f:
|
10 |
prompt_list = json.load(f)
|
11 |
|
12 |
-
|
13 |
-
lines = f.readlines()
|
14 |
-
|
15 |
-
image_list = {}
|
16 |
-
for line in lines:
|
17 |
-
idx = line.split('.png')[0].split('_')[-1]
|
18 |
-
url = line.split(')')[0].split('(')[-1]
|
19 |
-
image_list[eval(idx)] = url
|
20 |
-
|
21 |
|
22 |
class State:
|
23 |
def __init__(self,
|
@@ -99,7 +91,7 @@ def sample_prompt(state, model_name):
|
|
99 |
if state is None:
|
100 |
state = State(model_name)
|
101 |
|
102 |
-
idx = random.randint(0,
|
103 |
prompt = prompt_list[idx]
|
104 |
|
105 |
state.model_name = model_name
|
@@ -115,7 +107,7 @@ def sample_prompt_side_by_side(state_0, state_1, model_name_0, model_name_1):
|
|
115 |
if state_1 is None:
|
116 |
state_1 = State(model_name_1)
|
117 |
|
118 |
-
idx = random.randint(0,
|
119 |
prompt = prompt_list[idx]
|
120 |
|
121 |
state_0.i2s_mode, state_1.i2s_mode = False, False
|
@@ -128,8 +120,8 @@ def sample_image(state, model_name):
|
|
128 |
if state is None:
|
129 |
state = State(model_name)
|
130 |
|
131 |
-
idx = random.
|
132 |
-
img_url =
|
133 |
|
134 |
state.model_name = model_name
|
135 |
state.image = img_url
|
@@ -144,9 +136,8 @@ def sample_image_side_by_side(state_0, state_1, model_name_0, model_name_1):
|
|
144 |
if state_1 is None:
|
145 |
state_1 = State(model_name_1)
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
img_url = image_list[idx]
|
150 |
|
151 |
state_0.i2s_mode, state_1.i2s_mode = True, True
|
152 |
state_0.offline, state_1.offline = True, True
|
@@ -495,7 +486,7 @@ def generate_i2s(gen_func, render_func, state, image, model_name, request: gr.Re
|
|
495 |
state = State(model_name, i2s_mode=True, offline=False)
|
496 |
|
497 |
ip = get_ip(request)
|
498 |
-
|
499 |
|
500 |
state.model_name = model_name
|
501 |
state.image = image
|
@@ -584,7 +575,7 @@ def generate_i2s_multi(gen_func, render_func,
|
|
584 |
state_1 = State(model_name_1, i2s_mode=True, offline=False)
|
585 |
|
586 |
ip = get_ip(request)
|
587 |
-
|
588 |
|
589 |
state_0.model_name, state_1.model_name = model_name_0, model_name_1
|
590 |
state_0.image, state_1.image = image, image
|
@@ -698,7 +689,7 @@ def generate_i2s_multi_annoy(gen_func, render_func,
|
|
698 |
state_1 = State(model_name_1, i2s_mode=True, offline=False)
|
699 |
|
700 |
ip = get_ip(request)
|
701 |
-
|
702 |
|
703 |
state_0.model_name, state_1.model_name = model_name_0, model_name_1
|
704 |
state_0.image, state_1.image = image, image
|
|
|
4 |
|
5 |
from .utils import *
|
6 |
from .vote_utils import t2s_logger, t2s_multi_logger, i2s_logger, i2s_multi_logger
|
7 |
+
from constants import IMAGE_DIR, LOG_SERVER, TEXT_PROMPT_PATH, PROMPT_NUM
|
8 |
|
9 |
with open(TEXT_PROMPT_PATH, 'r') as f:
|
10 |
prompt_list = json.load(f)
|
11 |
|
12 |
+
assert len(prompt_list) == PROMPT_NUM, f"Load {len(prompt_list)} text prompts, but expected {PROMPT_NUM}."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
class State:
|
15 |
def __init__(self,
|
|
|
91 |
if state is None:
|
92 |
state = State(model_name)
|
93 |
|
94 |
+
idx = random.randint(0, PROMPT_NUM-1)
|
95 |
prompt = prompt_list[idx]
|
96 |
|
97 |
state.model_name = model_name
|
|
|
107 |
if state_1 is None:
|
108 |
state_1 = State(model_name_1)
|
109 |
|
110 |
+
idx = random.randint(0, PROMPT_NUM-1)
|
111 |
prompt = prompt_list[idx]
|
112 |
|
113 |
state_0.i2s_mode, state_1.i2s_mode = False, False
|
|
|
120 |
if state is None:
|
121 |
state = State(model_name)
|
122 |
|
123 |
+
idx = random.randint(0, PROMPT_NUM-1)
|
124 |
+
img_url = f"{LOG_SERVER}/get_rgba_{idx}"
|
125 |
|
126 |
state.model_name = model_name
|
127 |
state.image = img_url
|
|
|
136 |
if state_1 is None:
|
137 |
state_1 = State(model_name_1)
|
138 |
|
139 |
+
idx = random.randint(0, PROMPT_NUM-1)
|
140 |
+
img_url = f"{LOG_SERVER}/get_rgba_{idx}"
|
|
|
141 |
|
142 |
state_0.i2s_mode, state_1.i2s_mode = True, True
|
143 |
state_0.offline, state_1.offline = True, True
|
|
|
486 |
state = State(model_name, i2s_mode=True, offline=False)
|
487 |
|
488 |
ip = get_ip(request)
|
489 |
+
i2s_logger.info(f"generate. ip: {ip}")
|
490 |
|
491 |
state.model_name = model_name
|
492 |
state.image = image
|
|
|
575 |
state_1 = State(model_name_1, i2s_mode=True, offline=False)
|
576 |
|
577 |
ip = get_ip(request)
|
578 |
+
i2s_multi_logger.info(f"generate. ip: {ip}")
|
579 |
|
580 |
state_0.model_name, state_1.model_name = model_name_0, model_name_1
|
581 |
state_0.image, state_1.image = image, image
|
|
|
689 |
state_1 = State(model_name_1, i2s_mode=True, offline=False)
|
690 |
|
691 |
ip = get_ip(request)
|
692 |
+
i2s_multi_logger.info(f"generate. ip: {ip}")
|
693 |
|
694 |
state_0.model_name, state_1.model_name = model_name_0, model_name_1
|
695 |
state_0.image, state_1.image = image, image
|
serve/log_server.py
CHANGED
@@ -63,7 +63,6 @@ async def save_log(message: str = Form(...), log_path: str = Form(...)):
|
|
63 |
logger.info(f"Romote log message saved to {log_path}")
|
64 |
return {"message": f"Log message saved successfully to {log_path}"}
|
65 |
|
66 |
-
|
67 |
app.include_router(router)
|
68 |
|
69 |
if __name__ == "__main__":
|
|
|
63 |
logger.info(f"Romote log message saved to {log_path}")
|
64 |
return {"message": f"Log message saved successfully to {log_path}"}
|
65 |
|
|
|
66 |
app.include_router(router)
|
67 |
|
68 |
if __name__ == "__main__":
|
serve/utils.py
CHANGED
@@ -78,6 +78,8 @@ block_css = """
|
|
78 |
background-color: white;
|
79 |
}
|
80 |
#input_box textarea {
|
|
|
|
|
81 |
}
|
82 |
footer {
|
83 |
display:none !important
|
@@ -118,13 +120,14 @@ def disable_buttons():
|
|
118 |
def reset_state(state):
|
119 |
state.normal_video, state.rgb_video = None, None
|
120 |
state.evaluted_dims = 0
|
121 |
-
return (state,) + tuple(gr.update(interactive=False) for _ in range(EVALUATE_DIMS*3 + 2))
|
122 |
|
123 |
def reset_states_side_by_side(state_0, state_1):
|
124 |
state_0.normal_video, state_0.rgb_video = None, None
|
125 |
state_1.normal_video, state_1.rgb_video = None, None
|
126 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
127 |
return (state_0, state_1) \
|
|
|
128 |
+ tuple(gr.update(visible=(i>=EVALUATE_DIMS*4), interactive=False) for i in range(EVALUATE_DIMS*4 + 2)) \
|
129 |
+ tuple(gr.update(visible=False) for _ in range(EVALUATE_DIMS))
|
130 |
|
@@ -135,6 +138,7 @@ def reset_states_side_by_side_anony(state_0, state_1):
|
|
135 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
136 |
return (state_0, state_1) \
|
137 |
+ (gr.Markdown("", visible=False), gr.Markdown("", visible=False))\
|
|
|
138 |
+ tuple(gr.update(visible=(i>=EVALUATE_DIMS*4), interactive=False) for i in range(EVALUATE_DIMS*4 + 2)) \
|
139 |
+ tuple(gr.update(visible=False) for _ in range(EVALUATE_DIMS))
|
140 |
|
|
|
78 |
background-color: white;
|
79 |
}
|
80 |
#input_box textarea {
|
81 |
+
font-weight: bold;
|
82 |
+
font-size: 125%;
|
83 |
}
|
84 |
footer {
|
85 |
display:none !important
|
|
|
120 |
def reset_state(state):
|
121 |
state.normal_video, state.rgb_video = None, None
|
122 |
state.evaluted_dims = 0
|
123 |
+
return (state, None, None) + tuple(gr.update(interactive=False) for _ in range(EVALUATE_DIMS*3 + 2))
|
124 |
|
125 |
def reset_states_side_by_side(state_0, state_1):
|
126 |
state_0.normal_video, state_0.rgb_video = None, None
|
127 |
state_1.normal_video, state_1.rgb_video = None, None
|
128 |
state_0.evaluted_dims, state_1.evaluted_dims = 0, 0
|
129 |
return (state_0, state_1) \
|
130 |
+
+ (None,) * 4\
|
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 |
|
|
|
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 |
+
+ (None,) * 4 \
|
142 |
+ tuple(gr.update(visible=(i>=EVALUATE_DIMS*4), interactive=False) for i in range(EVALUATE_DIMS*4 + 2)) \
|
143 |
+ tuple(gr.update(visible=False) for _ in range(EVALUATE_DIMS))
|
144 |
|