Spaces:
Running
on
Zero
Running
on
Zero
update full-screen
Browse files
app.py
CHANGED
@@ -880,7 +880,7 @@ def make_dataset_images_section(advanced=False, is_random=False):
|
|
880 |
|
881 |
def make_output_images_section():
|
882 |
gr.Markdown('### Output Images')
|
883 |
-
output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto")
|
884 |
return output_gallery
|
885 |
|
886 |
def make_parameters_section(is_lisa=False):
|
@@ -1075,13 +1075,13 @@ with demo:
|
|
1075 |
with gr.Row():
|
1076 |
with gr.Column(scale=5, min_width=200):
|
1077 |
gr.Markdown('### Output (Recursion #1)')
|
1078 |
-
l1_gallery = gr.Gallery(value=[], label="Recursion #1", show_label=False, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto")
|
1079 |
with gr.Column(scale=5, min_width=200):
|
1080 |
gr.Markdown('### Output (Recursion #2)')
|
1081 |
-
l2_gallery = gr.Gallery(value=[], label="Recursion #2", show_label=False, elem_id="ncut_l2", columns=[3], rows=[5], object_fit="contain", height="auto")
|
1082 |
with gr.Column(scale=5, min_width=200):
|
1083 |
gr.Markdown('### Output (Recursion #3)')
|
1084 |
-
l3_gallery = gr.Gallery(value=[], label="Recursion #3", show_label=False, elem_id="ncut_l3", columns=[3], rows=[5], object_fit="contain", height="auto")
|
1085 |
with gr.Row():
|
1086 |
with gr.Column(scale=5, min_width=200):
|
1087 |
input_gallery, submit_button, clear_images_button = make_input_images_section()
|
@@ -1200,15 +1200,15 @@ with demo:
|
|
1200 |
with gr.Row():
|
1201 |
with gr.Column(scale=5, min_width=200):
|
1202 |
gr.Markdown('### Output (Prompt #1)')
|
1203 |
-
l1_gallery = gr.Gallery(value=[], label="Prompt #1", show_label=False, elem_id="ncut_p1", columns=[3], rows=[5], object_fit="contain", height="auto")
|
1204 |
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)
|
1205 |
with gr.Column(scale=5, min_width=200):
|
1206 |
gr.Markdown('### Output (Prompt #2)')
|
1207 |
-
l2_gallery = gr.Gallery(value=[], label="Prompt #2", show_label=False, elem_id="ncut_p2", columns=[3], rows=[5], object_fit="contain", height="auto")
|
1208 |
prompt2 = gr.Textbox(label="Input Prompt #2", elem_id="prompt2", value="where is the Gibson Les Pual guitar", lines=3)
|
1209 |
with gr.Column(scale=5, min_width=200):
|
1210 |
gr.Markdown('### Output (Prompt #3)')
|
1211 |
-
l3_gallery = gr.Gallery(value=[], label="Prompt #3", show_label=False, elem_id="ncut_p3", columns=[3], rows=[5], object_fit="contain", height="auto")
|
1212 |
prompt3 = gr.Textbox(label="Input Prompt #3", elem_id="prompt3", value="where is the floor", lines=3)
|
1213 |
|
1214 |
with gr.Row():
|
@@ -1288,7 +1288,7 @@ with demo:
|
|
1288 |
# for i_layer in range(1, 13):
|
1289 |
# with gr.Column(scale=5, min_width=200):
|
1290 |
# gr.Markdown(f'### {model_name} Layer {i_layer}')
|
1291 |
-
# output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto")
|
1292 |
# galleries.append(output_gallery)
|
1293 |
|
1294 |
|
@@ -1316,7 +1316,7 @@ with demo:
|
|
1316 |
def add_one_model(i_model=1):
|
1317 |
with gr.Column(scale=5, min_width=200) as col:
|
1318 |
gr.Markdown(f'### Output Images')
|
1319 |
-
output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id=f"ncut{i_model}", columns=[3], rows=[1], object_fit="contain", height="auto")
|
1320 |
submit_button = gr.Button("🔴 RUN", elem_id=f"submit_button{i_model}", variant='primary')
|
1321 |
[
|
1322 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
@@ -1385,7 +1385,7 @@ with demo:
|
|
1385 |
buttons[-1].click(fn=lambda x: gr.update(visible=False), outputs=buttons[-1])
|
1386 |
|
1387 |
|
1388 |
-
with gr.Tab('About'):
|
1389 |
gr.Markdown("##### This demo is for python package `ncut-pytorch`, please visit the [Documentation](https://ncut-pytorch.readthedocs.io/) ")
|
1390 |
gr.Markdown("---")
|
1391 |
gr.Markdown("**Normalized Cuts**, aka. spectral clustering, is a graphical method to analyze data grouping in the affinity eigenvector space. It has been widely used for unsupervised segmentation in the 2000s.")
|
|
|
880 |
|
881 |
def make_output_images_section():
|
882 |
gr.Markdown('### Output Images')
|
883 |
+
output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto", show_fullscreen_button=False, show_share_button=True)
|
884 |
return output_gallery
|
885 |
|
886 |
def make_parameters_section(is_lisa=False):
|
|
|
1075 |
with gr.Row():
|
1076 |
with gr.Column(scale=5, min_width=200):
|
1077 |
gr.Markdown('### Output (Recursion #1)')
|
1078 |
+
l1_gallery = gr.Gallery(value=[], label="Recursion #1", show_label=False, elem_id="ncut_l1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1079 |
with gr.Column(scale=5, min_width=200):
|
1080 |
gr.Markdown('### Output (Recursion #2)')
|
1081 |
+
l2_gallery = gr.Gallery(value=[], label="Recursion #2", show_label=False, elem_id="ncut_l2", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1082 |
with gr.Column(scale=5, min_width=200):
|
1083 |
gr.Markdown('### Output (Recursion #3)')
|
1084 |
+
l3_gallery = gr.Gallery(value=[], label="Recursion #3", show_label=False, elem_id="ncut_l3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1085 |
with gr.Row():
|
1086 |
with gr.Column(scale=5, min_width=200):
|
1087 |
input_gallery, submit_button, clear_images_button = make_input_images_section()
|
|
|
1200 |
with gr.Row():
|
1201 |
with gr.Column(scale=5, min_width=200):
|
1202 |
gr.Markdown('### Output (Prompt #1)')
|
1203 |
+
l1_gallery = gr.Gallery(value=[], label="Prompt #1", show_label=False, elem_id="ncut_p1", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1204 |
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)
|
1205 |
with gr.Column(scale=5, min_width=200):
|
1206 |
gr.Markdown('### Output (Prompt #2)')
|
1207 |
+
l2_gallery = gr.Gallery(value=[], label="Prompt #2", show_label=False, elem_id="ncut_p2", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1208 |
prompt2 = gr.Textbox(label="Input Prompt #2", elem_id="prompt2", value="where is the Gibson Les Pual guitar", lines=3)
|
1209 |
with gr.Column(scale=5, min_width=200):
|
1210 |
gr.Markdown('### Output (Prompt #3)')
|
1211 |
+
l3_gallery = gr.Gallery(value=[], label="Prompt #3", show_label=False, elem_id="ncut_p3", columns=[3], rows=[5], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1212 |
prompt3 = gr.Textbox(label="Input Prompt #3", elem_id="prompt3", value="where is the floor", lines=3)
|
1213 |
|
1214 |
with gr.Row():
|
|
|
1288 |
# for i_layer in range(1, 13):
|
1289 |
# with gr.Column(scale=5, min_width=200):
|
1290 |
# gr.Markdown(f'### {model_name} Layer {i_layer}')
|
1291 |
+
# output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto", show_fullscreen_button=True)
|
1292 |
# galleries.append(output_gallery)
|
1293 |
|
1294 |
|
|
|
1316 |
def add_one_model(i_model=1):
|
1317 |
with gr.Column(scale=5, min_width=200) as col:
|
1318 |
gr.Markdown(f'### Output Images')
|
1319 |
+
output_gallery = gr.Gallery(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)
|
1320 |
submit_button = gr.Button("🔴 RUN", elem_id=f"submit_button{i_model}", variant='primary')
|
1321 |
[
|
1322 |
model_dropdown, layer_slider, node_type_dropdown, num_eig_slider,
|
|
|
1385 |
buttons[-1].click(fn=lambda x: gr.update(visible=False), outputs=buttons[-1])
|
1386 |
|
1387 |
|
1388 |
+
with gr.Tab('📄About'):
|
1389 |
gr.Markdown("##### This demo is for python package `ncut-pytorch`, please visit the [Documentation](https://ncut-pytorch.readthedocs.io/) ")
|
1390 |
gr.Markdown("---")
|
1391 |
gr.Markdown("**Normalized Cuts**, aka. spectral clustering, is a graphical method to analyze data grouping in the affinity eigenvector space. It has been widely used for unsupervised segmentation in the 2000s.")
|