Spaces:
Running
on
Zero
Running
on
Zero
update UI
Browse files
app.py
CHANGED
@@ -1105,9 +1105,9 @@ def run_fn(
|
|
1105 |
|
1106 |
|
1107 |
|
1108 |
-
def make_input_images_section(rows=1, height="auto"):
|
1109 |
gr.Markdown('### Input Images')
|
1110 |
-
input_gallery = gr.Gallery(value=None, label="Select images", show_label=True, elem_id="images", columns=[
|
1111 |
submit_button = gr.Button("🔴 RUN", elem_id="submit_button", variant='primary')
|
1112 |
clear_images_button = gr.Button("🗑️Clear", elem_id='clear_button', variant='stop')
|
1113 |
return input_gallery, submit_button, clear_images_button
|
@@ -1570,6 +1570,12 @@ with demo:
|
|
1570 |
gr.Markdown('---')
|
1571 |
|
1572 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
1573 |
with gr.Column(scale=5, min_width=200):
|
1574 |
gr.Markdown('### Output (Recursion #1)')
|
1575 |
l1_gallery = gr.Gallery(format='png', value=[], label="Recursion #1", show_label=True, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
@@ -1583,12 +1589,6 @@ with demo:
|
|
1583 |
l3_gallery = gr.Gallery(format='png', value=[], label="Recursion #3", show_label=True, elem_id="ncut_l3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
1584 |
add_output_images_buttons(l3_gallery)
|
1585 |
with gr.Row():
|
1586 |
-
with gr.Column(scale=5, min_width=200):
|
1587 |
-
input_gallery, submit_button, clear_images_button = make_input_images_section()
|
1588 |
-
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
1589 |
-
num_images_slider.value = 100
|
1590 |
-
clear_images_button.visible = False
|
1591 |
-
logging_text = gr.Textbox("Logging information", label="Logging", elem_id="logging", type="text", placeholder="Logging information")
|
1592 |
|
1593 |
with gr.Column(scale=5, min_width=200):
|
1594 |
with gr.Accordion("➡️ Recursion config", open=True):
|
@@ -1599,6 +1599,7 @@ with demo:
|
|
1599 |
l1_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #1: Affinity focal gamma", value=0.5, elem_id="recursion_l1_gamma")
|
1600 |
l2_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #2: Affinity focal gamma", value=0.5, elem_id="recursion_l2_gamma")
|
1601 |
l3_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #3: Affinity focal gamma", value=0.5, elem_id="recursion_l3_gamma")
|
|
|
1602 |
[
|
1603 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
1604 |
affinity_focal_gamma_slider, num_sample_ncut_slider, ncut_knn_slider, ncut_indirect_connection, ncut_make_orthogonal,
|
@@ -1637,6 +1638,12 @@ with demo:
|
|
1637 |
with gr.Tab('Recursive Cut (Advanced)', visible=False) as tab_recursivecut_advanced:
|
1638 |
|
1639 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
1640 |
with gr.Column(scale=5, min_width=200):
|
1641 |
gr.Markdown('### Output (Recursion #1)')
|
1642 |
l1_gallery = gr.Gallery(format='png', value=[], label="Recursion #1", show_label=True, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
@@ -1655,13 +1662,8 @@ with demo:
|
|
1655 |
add_output_images_buttons(l3_gallery)
|
1656 |
l3_norm_gallery = gr.Gallery(value=[], label="Recursion #3 Eigenvector Magnitude", show_label=True, elem_id="eig_norm", columns=[3], rows=[1], object_fit="contain", height="auto", show_share_button=True, preview=False, interactive=False)
|
1657 |
l3_cluster_gallery = gr.Gallery(value=[], label="Recursion #3 Clusters", show_label=True, elem_id="clusters", columns=[2], rows=[4], object_fit="contain", height=600, show_share_button=True, preview=True, interactive=False)
|
1658 |
-
|
1659 |
-
|
1660 |
-
input_gallery, submit_button, clear_images_button = make_input_images_section(rows=5, height=1000)
|
1661 |
-
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
1662 |
-
num_images_slider.value = 100
|
1663 |
-
clear_images_button.visible = False
|
1664 |
-
|
1665 |
with gr.Column(scale=5, min_width=200):
|
1666 |
with gr.Accordion("➡️ Recursion config", open=True):
|
1667 |
l1_num_eig_slider = gr.Slider(1, 1000, step=1, label="Recursion #1: N eigenvectors", value=100, elem_id="l1_num_eig")
|
@@ -1671,6 +1673,7 @@ with demo:
|
|
1671 |
l1_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #1: Affinity focal gamma", value=0.5, elem_id="recursion_l1_gamma")
|
1672 |
l2_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #2: Affinity focal gamma", value=0.5, elem_id="recursion_l2_gamma")
|
1673 |
l3_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #3: Affinity focal gamma", value=0.5, elem_id="recursion_l3_gamma")
|
|
|
1674 |
[
|
1675 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
1676 |
affinity_focal_gamma_slider, num_sample_ncut_slider, ncut_knn_slider, ncut_indirect_connection, ncut_make_orthogonal,
|
@@ -1680,7 +1683,6 @@ with demo:
|
|
1680 |
] = make_parameters_section()
|
1681 |
num_eig_slider.visible = False
|
1682 |
affinity_focal_gamma_slider.visible = False
|
1683 |
-
logging_text = gr.Textbox("Logging information", label="Logging", elem_id="logging", type="text", placeholder="Logging information")
|
1684 |
true_placeholder = gr.Checkbox(label="True placeholder", value=True, elem_id="true_placeholder")
|
1685 |
true_placeholder.visible = False
|
1686 |
false_placeholder = gr.Checkbox(label="False placeholder", value=False, elem_id="false_placeholder")
|
@@ -2002,7 +2004,7 @@ with demo:
|
|
2002 |
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
2003 |
|
2004 |
|
2005 |
-
for i in range(
|
2006 |
add_one_model()
|
2007 |
|
2008 |
# Create rows and buttons in a loop
|
@@ -2014,7 +2016,7 @@ with demo:
|
|
2014 |
rows.append(row)
|
2015 |
|
2016 |
with row:
|
2017 |
-
for j in range(
|
2018 |
with gr.Column(scale=5, min_width=200):
|
2019 |
add_one_model()
|
2020 |
|
@@ -2077,7 +2079,7 @@ with demo:
|
|
2077 |
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
2078 |
|
2079 |
|
2080 |
-
for i in range(
|
2081 |
add_one_model()
|
2082 |
|
2083 |
# Create rows and buttons in a loop
|
@@ -2089,7 +2091,7 @@ with demo:
|
|
2089 |
rows.append(row)
|
2090 |
|
2091 |
with row:
|
2092 |
-
for j in range(
|
2093 |
with gr.Column(scale=5, min_width=200):
|
2094 |
add_one_model()
|
2095 |
|
|
|
1105 |
|
1106 |
|
1107 |
|
1108 |
+
def make_input_images_section(rows=1, cols=3, height="auto"):
|
1109 |
gr.Markdown('### Input Images')
|
1110 |
+
input_gallery = gr.Gallery(value=None, label="Select images", show_label=True, elem_id="images", columns=[cols], rows=[rows], object_fit="contain", height=height, type="pil", show_share_button=False)
|
1111 |
submit_button = gr.Button("🔴 RUN", elem_id="submit_button", variant='primary')
|
1112 |
clear_images_button = gr.Button("🗑️Clear", elem_id='clear_button', variant='stop')
|
1113 |
return input_gallery, submit_button, clear_images_button
|
|
|
1570 |
gr.Markdown('---')
|
1571 |
|
1572 |
with gr.Row():
|
1573 |
+
with gr.Column(scale=5, min_width=200):
|
1574 |
+
input_gallery, submit_button, clear_images_button = make_input_images_section()
|
1575 |
+
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
1576 |
+
num_images_slider.value = 100
|
1577 |
+
clear_images_button.visible = False
|
1578 |
+
logging_text = gr.Textbox("Logging information", label="Logging", elem_id="logging", type="text", placeholder="Logging information")
|
1579 |
with gr.Column(scale=5, min_width=200):
|
1580 |
gr.Markdown('### Output (Recursion #1)')
|
1581 |
l1_gallery = gr.Gallery(format='png', value=[], label="Recursion #1", show_label=True, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
|
|
1589 |
l3_gallery = gr.Gallery(format='png', value=[], label="Recursion #3", show_label=True, elem_id="ncut_l3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
1590 |
add_output_images_buttons(l3_gallery)
|
1591 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
1592 |
|
1593 |
with gr.Column(scale=5, min_width=200):
|
1594 |
with gr.Accordion("➡️ Recursion config", open=True):
|
|
|
1599 |
l1_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #1: Affinity focal gamma", value=0.5, elem_id="recursion_l1_gamma")
|
1600 |
l2_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #2: Affinity focal gamma", value=0.5, elem_id="recursion_l2_gamma")
|
1601 |
l3_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #3: Affinity focal gamma", value=0.5, elem_id="recursion_l3_gamma")
|
1602 |
+
with gr.Column(scale=5, min_width=200):
|
1603 |
[
|
1604 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
1605 |
affinity_focal_gamma_slider, num_sample_ncut_slider, ncut_knn_slider, ncut_indirect_connection, ncut_make_orthogonal,
|
|
|
1638 |
with gr.Tab('Recursive Cut (Advanced)', visible=False) as tab_recursivecut_advanced:
|
1639 |
|
1640 |
with gr.Row():
|
1641 |
+
with gr.Column(scale=5, min_width=200):
|
1642 |
+
input_gallery, submit_button, clear_images_button = make_input_images_section(rows=5, cols=3, height='auto')
|
1643 |
+
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
1644 |
+
num_images_slider.value = 100
|
1645 |
+
clear_images_button.visible = False
|
1646 |
+
logging_text = gr.Textbox("Logging information", label="Logging", elem_id="logging", type="text", placeholder="Logging information")
|
1647 |
with gr.Column(scale=5, min_width=200):
|
1648 |
gr.Markdown('### Output (Recursion #1)')
|
1649 |
l1_gallery = gr.Gallery(format='png', value=[], label="Recursion #1", show_label=True, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True, interactive=False)
|
|
|
1662 |
add_output_images_buttons(l3_gallery)
|
1663 |
l3_norm_gallery = gr.Gallery(value=[], label="Recursion #3 Eigenvector Magnitude", show_label=True, elem_id="eig_norm", columns=[3], rows=[1], object_fit="contain", height="auto", show_share_button=True, preview=False, interactive=False)
|
1664 |
l3_cluster_gallery = gr.Gallery(value=[], label="Recursion #3 Clusters", show_label=True, elem_id="clusters", columns=[2], rows=[4], object_fit="contain", height=600, show_share_button=True, preview=True, interactive=False)
|
1665 |
+
|
1666 |
+
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
1667 |
with gr.Column(scale=5, min_width=200):
|
1668 |
with gr.Accordion("➡️ Recursion config", open=True):
|
1669 |
l1_num_eig_slider = gr.Slider(1, 1000, step=1, label="Recursion #1: N eigenvectors", value=100, elem_id="l1_num_eig")
|
|
|
1673 |
l1_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #1: Affinity focal gamma", value=0.5, elem_id="recursion_l1_gamma")
|
1674 |
l2_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #2: Affinity focal gamma", value=0.5, elem_id="recursion_l2_gamma")
|
1675 |
l3_affinity_focal_gamma_slider = gr.Slider(0.01, 1, step=0.01, label="Recursion #3: Affinity focal gamma", value=0.5, elem_id="recursion_l3_gamma")
|
1676 |
+
with gr.Column(scale=5, min_width=200):
|
1677 |
[
|
1678 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
1679 |
affinity_focal_gamma_slider, num_sample_ncut_slider, ncut_knn_slider, ncut_indirect_connection, ncut_make_orthogonal,
|
|
|
1683 |
] = make_parameters_section()
|
1684 |
num_eig_slider.visible = False
|
1685 |
affinity_focal_gamma_slider.visible = False
|
|
|
1686 |
true_placeholder = gr.Checkbox(label="True placeholder", value=True, elem_id="true_placeholder")
|
1687 |
true_placeholder.visible = False
|
1688 |
false_placeholder = gr.Checkbox(label="False placeholder", value=False, elem_id="false_placeholder")
|
|
|
2004 |
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
2005 |
|
2006 |
|
2007 |
+
for i in range(3):
|
2008 |
add_one_model()
|
2009 |
|
2010 |
# Create rows and buttons in a loop
|
|
|
2016 |
rows.append(row)
|
2017 |
|
2018 |
with row:
|
2019 |
+
for j in range(4):
|
2020 |
with gr.Column(scale=5, min_width=200):
|
2021 |
add_one_model()
|
2022 |
|
|
|
2079 |
dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
|
2080 |
|
2081 |
|
2082 |
+
for i in range(3):
|
2083 |
add_one_model()
|
2084 |
|
2085 |
# Create rows and buttons in a loop
|
|
|
2091 |
rows.append(row)
|
2092 |
|
2093 |
with row:
|
2094 |
+
for j in range(4):
|
2095 |
with gr.Column(scale=5, min_width=200):
|
2096 |
add_one_model()
|
2097 |
|