Spaces:
Running
on
Zero
Running
on
Zero
fix interactive UI
Browse files
app.py
CHANGED
|
@@ -1074,7 +1074,7 @@ def add_output_images_buttons(output_gallery):
|
|
| 1074 |
|
| 1075 |
def make_output_images_section():
|
| 1076 |
gr.Markdown('### Output Images')
|
| 1077 |
-
output_gallery = gr.Gallery(format='png', value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto", show_share_button=True)
|
| 1078 |
add_output_images_buttons(output_gallery)
|
| 1079 |
return output_gallery
|
| 1080 |
|
|
@@ -1100,7 +1100,7 @@ def make_parameters_section(is_lisa=False):
|
|
| 1100 |
negative_prompt = gr.Textbox(label="Prompt (Negative)", elem_id="prompt", placeholder="e.g. 'a photo from egocentric view'")
|
| 1101 |
negative_prompt.visible = False
|
| 1102 |
node_type_dropdown = gr.Dropdown(["attn: attention output", "mlp: mlp output", "block: sum of residual"], label="Backbone: Layer type", value="block: sum of residual", elem_id="node_type", info="which feature to take from each layer?")
|
| 1103 |
-
num_eig_slider = gr.Slider(1, 1000, step=1, label="NCUT: Number of eigenvectors", value=100, elem_id="num_eig", info='increase for
|
| 1104 |
|
| 1105 |
def change_layer_slider(model_name):
|
| 1106 |
# SD2, UNET
|
|
@@ -1170,7 +1170,7 @@ with demo:
|
|
| 1170 |
|
| 1171 |
with gr.Column(scale=5, min_width=200):
|
| 1172 |
output_gallery = make_output_images_section()
|
| 1173 |
-
cluster_gallery = gr.Gallery(value=[], label="Clusters", show_label=False, elem_id="clusters", columns=[2], rows=[1], object_fit="contain", height=450, show_share_button=True, preview=True)
|
| 1174 |
[
|
| 1175 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
| 1176 |
affinity_focal_gamma_slider, num_sample_ncut_slider, knn_ncut_slider,
|
|
@@ -1272,15 +1272,15 @@ with demo:
|
|
| 1272 |
with gr.Row():
|
| 1273 |
with gr.Column(scale=5, min_width=200):
|
| 1274 |
gr.Markdown('### Output (Recursion #1)')
|
| 1275 |
-
l1_gallery = gr.Gallery(format='png', value=[], label="Recursion #1", show_label=False, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1276 |
add_output_images_buttons(l1_gallery)
|
| 1277 |
with gr.Column(scale=5, min_width=200):
|
| 1278 |
gr.Markdown('### Output (Recursion #2)')
|
| 1279 |
-
l2_gallery = gr.Gallery(format='png', value=[], label="Recursion #2", show_label=False, elem_id="ncut_l2", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1280 |
add_output_images_buttons(l2_gallery)
|
| 1281 |
with gr.Column(scale=5, min_width=200):
|
| 1282 |
gr.Markdown('### Output (Recursion #3)')
|
| 1283 |
-
l3_gallery = gr.Gallery(format='png', value=[], label="Recursion #3", show_label=False, elem_id="ncut_l3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1284 |
add_output_images_buttons(l3_gallery)
|
| 1285 |
with gr.Row():
|
| 1286 |
with gr.Column(scale=5, min_width=200):
|
|
@@ -1400,15 +1400,15 @@ with demo:
|
|
| 1400 |
with gr.Row():
|
| 1401 |
with gr.Column(scale=5, min_width=200):
|
| 1402 |
gr.Markdown('### Output (Prompt #1)')
|
| 1403 |
-
l1_gallery = gr.Gallery(format='png', value=[], label="Prompt #1", show_label=False, elem_id="ncut_p1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1404 |
prompt1 = gr.Textbox(label="Input Prompt #1", elem_id="prompt1", value="where is the person, include the clothes, don't include the guitar and chair", lines=3)
|
| 1405 |
with gr.Column(scale=5, min_width=200):
|
| 1406 |
gr.Markdown('### Output (Prompt #2)')
|
| 1407 |
-
l2_gallery = gr.Gallery(format='png', value=[], label="Prompt #2", show_label=False, elem_id="ncut_p2", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1408 |
prompt2 = gr.Textbox(label="Input Prompt #2", elem_id="prompt2", value="where is the Gibson Les Pual guitar", lines=3)
|
| 1409 |
with gr.Column(scale=5, min_width=200):
|
| 1410 |
gr.Markdown('### Output (Prompt #3)')
|
| 1411 |
-
l3_gallery = gr.Gallery(format='png', value=[], label="Prompt #3", show_label=False, elem_id="ncut_p3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1412 |
prompt3 = gr.Textbox(label="Input Prompt #3", elem_id="prompt3", value="where is the floor", lines=3)
|
| 1413 |
|
| 1414 |
with gr.Row():
|
|
@@ -1516,7 +1516,7 @@ with demo:
|
|
| 1516 |
def add_one_model(i_model=1):
|
| 1517 |
with gr.Column(scale=5, min_width=200) as col:
|
| 1518 |
gr.Markdown(f'### Output Images')
|
| 1519 |
-
output_gallery = gr.Gallery(format='png', value=[], label="NCUT Embedding", show_label=False, elem_id=f"ncut{i_model}", columns=[3], rows=[1], object_fit="contain", height="auto", show_fullscreen_button=True)
|
| 1520 |
submit_button = gr.Button("🔴 RUN", elem_id=f"submit_button{i_model}", variant='primary')
|
| 1521 |
add_output_images_buttons(output_gallery)
|
| 1522 |
[
|
|
|
|
| 1074 |
|
| 1075 |
def make_output_images_section():
|
| 1076 |
gr.Markdown('### Output Images')
|
| 1077 |
+
output_gallery = gr.Gallery(format='png', value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto", show_share_button=True, interactive=False)
|
| 1078 |
add_output_images_buttons(output_gallery)
|
| 1079 |
return output_gallery
|
| 1080 |
|
|
|
|
| 1100 |
negative_prompt = gr.Textbox(label="Prompt (Negative)", elem_id="prompt", placeholder="e.g. 'a photo from egocentric view'")
|
| 1101 |
negative_prompt.visible = False
|
| 1102 |
node_type_dropdown = gr.Dropdown(["attn: attention output", "mlp: mlp output", "block: sum of residual"], label="Backbone: Layer type", value="block: sum of residual", elem_id="node_type", info="which feature to take from each layer?")
|
| 1103 |
+
num_eig_slider = gr.Slider(1, 1000, step=1, label="NCUT: Number of eigenvectors", value=100, elem_id="num_eig", info='increase for smaller clusters')
|
| 1104 |
|
| 1105 |
def change_layer_slider(model_name):
|
| 1106 |
# SD2, UNET
|
|
|
|
| 1170 |
|
| 1171 |
with gr.Column(scale=5, min_width=200):
|
| 1172 |
output_gallery = make_output_images_section()
|
| 1173 |
+
cluster_gallery = gr.Gallery(value=[], label="Clusters", show_label=False, elem_id="clusters", columns=[2], rows=[1], object_fit="contain", height=450, show_share_button=True, preview=True, interactive=False)
|
| 1174 |
[
|
| 1175 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
| 1176 |
affinity_focal_gamma_slider, num_sample_ncut_slider, knn_ncut_slider,
|
|
|
|
| 1272 |
with gr.Row():
|
| 1273 |
with gr.Column(scale=5, min_width=200):
|
| 1274 |
gr.Markdown('### Output (Recursion #1)')
|
| 1275 |
+
l1_gallery = gr.Gallery(format='png', value=[], label="Recursion #1", show_label=False, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1276 |
add_output_images_buttons(l1_gallery)
|
| 1277 |
with gr.Column(scale=5, min_width=200):
|
| 1278 |
gr.Markdown('### Output (Recursion #2)')
|
| 1279 |
+
l2_gallery = gr.Gallery(format='png', value=[], label="Recursion #2", show_label=False, elem_id="ncut_l2", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1280 |
add_output_images_buttons(l2_gallery)
|
| 1281 |
with gr.Column(scale=5, min_width=200):
|
| 1282 |
gr.Markdown('### Output (Recursion #3)')
|
| 1283 |
+
l3_gallery = gr.Gallery(format='png', value=[], label="Recursion #3", show_label=False, elem_id="ncut_l3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1284 |
add_output_images_buttons(l3_gallery)
|
| 1285 |
with gr.Row():
|
| 1286 |
with gr.Column(scale=5, min_width=200):
|
|
|
|
| 1400 |
with gr.Row():
|
| 1401 |
with gr.Column(scale=5, min_width=200):
|
| 1402 |
gr.Markdown('### Output (Prompt #1)')
|
| 1403 |
+
l1_gallery = gr.Gallery(format='png', value=[], label="Prompt #1", show_label=False, elem_id="ncut_p1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1404 |
prompt1 = gr.Textbox(label="Input Prompt #1", elem_id="prompt1", value="where is the person, include the clothes, don't include the guitar and chair", lines=3)
|
| 1405 |
with gr.Column(scale=5, min_width=200):
|
| 1406 |
gr.Markdown('### Output (Prompt #2)')
|
| 1407 |
+
l2_gallery = gr.Gallery(format='png', value=[], label="Prompt #2", show_label=False, elem_id="ncut_p2", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1408 |
prompt2 = gr.Textbox(label="Input Prompt #2", elem_id="prompt2", value="where is the Gibson Les Pual guitar", lines=3)
|
| 1409 |
with gr.Column(scale=5, min_width=200):
|
| 1410 |
gr.Markdown('### Output (Prompt #3)')
|
| 1411 |
+
l3_gallery = gr.Gallery(format='png', value=[], label="Prompt #3", show_label=False, elem_id="ncut_p3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1412 |
prompt3 = gr.Textbox(label="Input Prompt #3", elem_id="prompt3", value="where is the floor", lines=3)
|
| 1413 |
|
| 1414 |
with gr.Row():
|
|
|
|
| 1516 |
def add_one_model(i_model=1):
|
| 1517 |
with gr.Column(scale=5, min_width=200) as col:
|
| 1518 |
gr.Markdown(f'### Output Images')
|
| 1519 |
+
output_gallery = gr.Gallery(format='png', value=[], label="NCUT Embedding", show_label=False, elem_id=f"ncut{i_model}", columns=[3], rows=[1], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
| 1520 |
submit_button = gr.Button("🔴 RUN", elem_id=f"submit_button{i_model}", variant='primary')
|
| 1521 |
add_output_images_buttons(output_gallery)
|
| 1522 |
[
|