Spaces:
Running
on
Zero
Running
on
Zero
DongfuJiang
commited on
Commit
•
b57f227
1
Parent(s):
c443141
update
Browse files- serve/gradio_web.py +10 -10
- serve/gradio_web_image_editing.py +2 -2
- serve/utils.py +2 -2
- serve/vote_utils.py +9 -14
serve/gradio_web.py
CHANGED
@@ -52,9 +52,9 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
52 |
|
53 |
with gr.Row():
|
54 |
with gr.Column():
|
55 |
-
model_selector_left =gr.Markdown("")
|
56 |
with gr.Column():
|
57 |
-
model_selector_right = gr.Markdown("")
|
58 |
with gr.Row():
|
59 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
60 |
|
@@ -143,22 +143,22 @@ Find out who is the 🥇conditional image generation models! More models are goi
|
|
143 |
leftvote_btn.click(
|
144 |
leftvote_last_response,
|
145 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
146 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
147 |
)
|
148 |
rightvote_btn.click(
|
149 |
rightvote_last_response,
|
150 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
151 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
152 |
)
|
153 |
tie_btn.click(
|
154 |
tievote_last_response,
|
155 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
156 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
157 |
)
|
158 |
bothbad_btn.click(
|
159 |
bothbad_vote_last_response,
|
160 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
161 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
162 |
)
|
163 |
|
164 |
|
@@ -304,22 +304,22 @@ def build_side_by_side_ui_named(models):
|
|
304 |
leftvote_btn.click(
|
305 |
leftvote_last_response,
|
306 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
307 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
308 |
)
|
309 |
rightvote_btn.click(
|
310 |
rightvote_last_response,
|
311 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
312 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
313 |
)
|
314 |
tie_btn.click(
|
315 |
tievote_last_response,
|
316 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
317 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
318 |
)
|
319 |
bothbad_btn.click(
|
320 |
bothbad_vote_last_response,
|
321 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
322 |
-
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn]
|
323 |
)
|
324 |
|
325 |
share_btn.click(
|
|
|
52 |
|
53 |
with gr.Row():
|
54 |
with gr.Column():
|
55 |
+
model_selector_left =gr.Markdown("", visible=False)
|
56 |
with gr.Column():
|
57 |
+
model_selector_right = gr.Markdown("", visible=False)
|
58 |
with gr.Row():
|
59 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
60 |
|
|
|
143 |
leftvote_btn.click(
|
144 |
leftvote_last_response,
|
145 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
146 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
147 |
)
|
148 |
rightvote_btn.click(
|
149 |
rightvote_last_response,
|
150 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
151 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
152 |
)
|
153 |
tie_btn.click(
|
154 |
tievote_last_response,
|
155 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
156 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
157 |
)
|
158 |
bothbad_btn.click(
|
159 |
bothbad_vote_last_response,
|
160 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
161 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
162 |
)
|
163 |
|
164 |
|
|
|
304 |
leftvote_btn.click(
|
305 |
leftvote_last_response,
|
306 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
307 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
308 |
)
|
309 |
rightvote_btn.click(
|
310 |
rightvote_last_response,
|
311 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
312 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
313 |
)
|
314 |
tie_btn.click(
|
315 |
tievote_last_response,
|
316 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
317 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
318 |
)
|
319 |
bothbad_btn.click(
|
320 |
bothbad_vote_last_response,
|
321 |
inputs=[state0, state1, model_selector_left, model_selector_right],
|
322 |
+
outputs=[textbox, leftvote_btn, rightvote_btn, tie_btn, bothbad_btn, model_selector_left, model_selector_right]
|
323 |
)
|
324 |
|
325 |
share_btn.click(
|
serve/gradio_web_image_editing.py
CHANGED
@@ -54,9 +54,9 @@ Find out who is the 🥇conditional image edition models!
|
|
54 |
|
55 |
with gr.Row():
|
56 |
with gr.Column():
|
57 |
-
model_selector_left =gr.Markdown("")
|
58 |
with gr.Column():
|
59 |
-
model_selector_right = gr.Markdown("")
|
60 |
with gr.Row():
|
61 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
62 |
|
|
|
54 |
|
55 |
with gr.Row():
|
56 |
with gr.Column():
|
57 |
+
model_selector_left =gr.Markdown("", visible=False)
|
58 |
with gr.Column():
|
59 |
+
model_selector_right = gr.Markdown("", visible=False)
|
60 |
with gr.Row():
|
61 |
slow_warning = gr.Markdown("", elem_id="notice_markdown")
|
62 |
|
serve/utils.py
CHANGED
@@ -114,7 +114,7 @@ def clear_history_side_by_side():
|
|
114 |
return None, None, "", None, None
|
115 |
|
116 |
def clear_history_side_by_side_anony():
|
117 |
-
return None, None, "", None, None, gr.Markdown(""), gr.Markdown("")
|
118 |
|
119 |
def clear_history_ie():
|
120 |
return None, "", "", "", None, None
|
@@ -123,7 +123,7 @@ def clear_history_side_by_side_ie():
|
|
123 |
return None, None, "", "", "", None, None, None
|
124 |
|
125 |
def clear_history_side_by_side_ie_anony():
|
126 |
-
return None, None, "", "", "", None, None, None, gr.Markdown(""), gr.Markdown("")
|
127 |
|
128 |
def get_ip(request: gr.Request):
|
129 |
if request:
|
|
|
114 |
return None, None, "", None, None
|
115 |
|
116 |
def clear_history_side_by_side_anony():
|
117 |
+
return None, None, "", None, None, gr.Markdown("", visible=False), gr.Markdown("", visible=False)
|
118 |
|
119 |
def clear_history_ie():
|
120 |
return None, "", "", "", None, None
|
|
|
123 |
return None, None, "", "", "", None, None, None
|
124 |
|
125 |
def clear_history_side_by_side_ie_anony():
|
126 |
+
return None, None, "", "", "", None, None, None, gr.Markdown("", visible=False), gr.Markdown("", visible=False)
|
127 |
|
128 |
def get_ip(request: gr.Request):
|
129 |
if request:
|
serve/vote_utils.py
CHANGED
@@ -113,7 +113,7 @@ def leftvote_last_response_igm(
|
|
113 |
vote_last_response_igm(
|
114 |
[state0, state1], "leftvote", [model_selector0, model_selector1], request
|
115 |
)
|
116 |
-
return ("",) + (disable_btn,) * 4
|
117 |
|
118 |
|
119 |
def rightvote_last_response_igm(
|
@@ -123,7 +123,7 @@ def rightvote_last_response_igm(
|
|
123 |
vote_last_response_igm(
|
124 |
[state0, state1], "rightvote", [model_selector0, model_selector1], request
|
125 |
)
|
126 |
-
return ("",) + (disable_btn,) * 4
|
127 |
|
128 |
|
129 |
def tievote_last_response_igm(
|
@@ -133,7 +133,7 @@ def tievote_last_response_igm(
|
|
133 |
vote_last_response_igm(
|
134 |
[state0, state1], "tievote", [model_selector0, model_selector1], request
|
135 |
)
|
136 |
-
return ("",) + (disable_btn,) * 4
|
137 |
|
138 |
|
139 |
def bothbad_vote_last_response_igm(
|
@@ -143,7 +143,7 @@ def bothbad_vote_last_response_igm(
|
|
143 |
vote_last_response_igm(
|
144 |
[state0, state1], "bothbad_vote", [model_selector0, model_selector1], request
|
145 |
)
|
146 |
-
return ("",) + (disable_btn,) * 4
|
147 |
|
148 |
## Image Editing (IE) Single Model Direct Chat
|
149 |
|
@@ -177,7 +177,8 @@ def leftvote_last_response_iem(
|
|
177 |
# "### Model A: " + state0.model_name,
|
178 |
# "### Model B: " + state1.model_name,
|
179 |
# )
|
180 |
-
names = (state0.model_name, state1.model_name)
|
|
|
181 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
182 |
|
183 |
def rightvote_last_response_iem(
|
@@ -191,7 +192,7 @@ def rightvote_last_response_iem(
|
|
191 |
# "### Model A: " + state0.model_name,
|
192 |
# "### Model B: " + state1.model_name,
|
193 |
# )
|
194 |
-
names = (state0.model_name, state1.model_name)
|
195 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
196 |
|
197 |
def tievote_last_response_iem(
|
@@ -201,10 +202,7 @@ def tievote_last_response_iem(
|
|
201 |
vote_last_response_iem(
|
202 |
[state0, state1], "tievote", [model_selector0, model_selector1], request
|
203 |
)
|
204 |
-
names = (
|
205 |
-
"### Model A: " + state0.model_name,
|
206 |
-
"### Model B: " + state1.model_name,
|
207 |
-
)
|
208 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
209 |
|
210 |
def bothbad_vote_last_response_iem(
|
@@ -214,10 +212,7 @@ def bothbad_vote_last_response_iem(
|
|
214 |
vote_last_response_iem(
|
215 |
[state0, state1], "bothbad_vote", [model_selector0, model_selector1], request
|
216 |
)
|
217 |
-
names = (
|
218 |
-
"### Model A: " + state0.model_name,
|
219 |
-
"### Model B: " + state1.model_name,
|
220 |
-
)
|
221 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
222 |
|
223 |
|
|
|
113 |
vote_last_response_igm(
|
114 |
[state0, state1], "leftvote", [model_selector0, model_selector1], request
|
115 |
)
|
116 |
+
return ("",) + (disable_btn,) * 4 + (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
117 |
|
118 |
|
119 |
def rightvote_last_response_igm(
|
|
|
123 |
vote_last_response_igm(
|
124 |
[state0, state1], "rightvote", [model_selector0, model_selector1], request
|
125 |
)
|
126 |
+
return ("",) + (disable_btn,) * 4 + (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
127 |
|
128 |
|
129 |
def tievote_last_response_igm(
|
|
|
133 |
vote_last_response_igm(
|
134 |
[state0, state1], "tievote", [model_selector0, model_selector1], request
|
135 |
)
|
136 |
+
return ("",) + (disable_btn,) * 4 + (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
137 |
|
138 |
|
139 |
def bothbad_vote_last_response_igm(
|
|
|
143 |
vote_last_response_igm(
|
144 |
[state0, state1], "bothbad_vote", [model_selector0, model_selector1], request
|
145 |
)
|
146 |
+
return ("",) + (disable_btn,) * 4 + (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
147 |
|
148 |
## Image Editing (IE) Single Model Direct Chat
|
149 |
|
|
|
177 |
# "### Model A: " + state0.model_name,
|
178 |
# "### Model B: " + state1.model_name,
|
179 |
# )
|
180 |
+
# names = (state0.model_name, state1.model_name)
|
181 |
+
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
182 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
183 |
|
184 |
def rightvote_last_response_iem(
|
|
|
192 |
# "### Model A: " + state0.model_name,
|
193 |
# "### Model B: " + state1.model_name,
|
194 |
# )
|
195 |
+
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
196 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
197 |
|
198 |
def tievote_last_response_iem(
|
|
|
202 |
vote_last_response_iem(
|
203 |
[state0, state1], "tievote", [model_selector0, model_selector1], request
|
204 |
)
|
205 |
+
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
|
|
|
|
|
|
206 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
207 |
|
208 |
def bothbad_vote_last_response_iem(
|
|
|
212 |
vote_last_response_iem(
|
213 |
[state0, state1], "bothbad_vote", [model_selector0, model_selector1], request
|
214 |
)
|
215 |
+
names = (gr.Markdown(f"### Model A: {state0.model_name}", visible=True), gr.Markdown(f"### Model B: {state1.model_name}", visible=True))
|
|
|
|
|
|
|
216 |
return names + ("", "", gr.Image(height=512, width=512, type="pil"), "") + (disable_btn,) * 4
|
217 |
|
218 |
|