Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ title = r"""
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
description = r"""
|
| 13 |
-
<b>
|
| 14 |
"""
|
| 15 |
|
| 16 |
article = r"""
|
|
@@ -25,8 +25,7 @@ If our work is helpful for your research or applications, please cite us via:
|
|
| 25 |
journal={arXiv preprint arXiv:2403.05846},
|
| 26 |
year={2024}
|
| 27 |
}
|
| 28 |
-
}
|
| 29 |
-
```
|
| 30 |
📧 **Contact**
|
| 31 |
<br>
|
| 32 |
If you have any questions, please feel free to open an issue or directly reach us out at <b>tok@cs.technuin.ac.il</b>.
|
|
@@ -44,7 +43,7 @@ def generate_images(prompt, model, seed):
|
|
| 44 |
gr.Info('Generating images from intermediate layers..')
|
| 45 |
all_images = [] # Initialize a list to store all images
|
| 46 |
max_num_of_layers = model_num_of_layers[model]
|
| 47 |
-
for skip_layers in range(max_num_of_layers, -1, -1):
|
| 48 |
# Pass the model and seed to the get_images function
|
| 49 |
images = get_images(prompt, skip_layers=skip_layers, model=model, seed=seed)
|
| 50 |
all_images.append((images[0], f'layer_{12 - skip_layers}'))
|
|
@@ -59,7 +58,7 @@ with gr.Blocks() as demo:
|
|
| 59 |
# model_select = gr.Dropdown(label="Select Model", choices=['sd1', 'sd2'])
|
| 60 |
# seed_input = gr.Number(label="Enter Seed", value=0) # Default seed set to 0
|
| 61 |
with gr.Column():
|
| 62 |
-
gallery = gr.Gallery(label="Generated Images", columns=
|
| 63 |
# Update the submit function to include the new inputs
|
| 64 |
|
| 65 |
|
|
@@ -68,7 +67,7 @@ with gr.Blocks() as demo:
|
|
| 68 |
with gr.Column():
|
| 69 |
prompt = gr.Textbox(
|
| 70 |
label="Prompt",
|
| 71 |
-
value="
|
| 72 |
)
|
| 73 |
|
| 74 |
model = gr.Radio(
|
|
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
description = r"""
|
| 13 |
+
<b>A demo for the paper <a href='https://arxiv.org/abs/2403.05846' target='_blank'>Diffusion Lens: Interpreting Text Encoders in Text-to-Image Pipelines</a>.<br>
|
| 14 |
"""
|
| 15 |
|
| 16 |
article = r"""
|
|
|
|
| 25 |
journal={arXiv preprint arXiv:2403.05846},
|
| 26 |
year={2024}
|
| 27 |
}
|
| 28 |
+
}```
|
|
|
|
| 29 |
📧 **Contact**
|
| 30 |
<br>
|
| 31 |
If you have any questions, please feel free to open an issue or directly reach us out at <b>tok@cs.technuin.ac.il</b>.
|
|
|
|
| 43 |
gr.Info('Generating images from intermediate layers..')
|
| 44 |
all_images = [] # Initialize a list to store all images
|
| 45 |
max_num_of_layers = model_num_of_layers[model]
|
| 46 |
+
for skip_layers in range(max_num_of_layers - 1, -1, -1):
|
| 47 |
# Pass the model and seed to the get_images function
|
| 48 |
images = get_images(prompt, skip_layers=skip_layers, model=model, seed=seed)
|
| 49 |
all_images.append((images[0], f'layer_{12 - skip_layers}'))
|
|
|
|
| 58 |
# model_select = gr.Dropdown(label="Select Model", choices=['sd1', 'sd2'])
|
| 59 |
# seed_input = gr.Number(label="Enter Seed", value=0) # Default seed set to 0
|
| 60 |
with gr.Column():
|
| 61 |
+
gallery = gr.Gallery(label="Generated Images", columns=4, rows=3, object_fit="contain", height="auto")
|
| 62 |
# Update the submit function to include the new inputs
|
| 63 |
|
| 64 |
|
|
|
|
| 67 |
with gr.Column():
|
| 68 |
prompt = gr.Textbox(
|
| 69 |
label="Prompt",
|
| 70 |
+
value="A photo of Steve Jobs",
|
| 71 |
)
|
| 72 |
|
| 73 |
model = gr.Radio(
|