Spaces:
Running
Running
tokeron
commited on
Commit
·
680fd14
1
Parent(s):
773453a
app updated
Browse files
app.py
CHANGED
@@ -7,21 +7,44 @@ import gradio as gr
|
|
7 |
import os
|
8 |
import subprocess
|
9 |
|
10 |
-
|
11 |
-
print('prompt:', prompt)
|
12 |
-
print('calling diffusion lens')
|
13 |
-
image = get_images(prompt, skip_layers=0)
|
14 |
-
return image
|
15 |
|
16 |
def display_images(images):
|
17 |
# Prepare images for display
|
18 |
return [gr.Image(image) for image in images]
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
if __name__ == '__main__':
|
21 |
with gr.Blocks() as demo:
|
22 |
gallery = gr.Gallery(
|
23 |
label="Generated images", show_label=False, elem_id="gallery",
|
24 |
-
columns=[
|
25 |
btn = gr.Button("Generate images", scale=0)
|
26 |
|
27 |
btn.click(get_prompt, 'text', gallery)
|
|
|
7 |
import os
|
8 |
import subprocess
|
9 |
|
10 |
+
|
|
|
|
|
|
|
|
|
11 |
|
12 |
def display_images(images):
|
13 |
# Prepare images for display
|
14 |
return [gr.Image(image) for image in images]
|
15 |
|
16 |
+
# def get_prompt(prompt):
|
17 |
+
# print('prompt:', prompt)
|
18 |
+
# print('calling diffusion lens')
|
19 |
+
# image = get_images(prompt, skip_layers=0)
|
20 |
+
# return image
|
21 |
+
#
|
22 |
+
# if __name__ == '__main__':
|
23 |
+
# with gr.Blocks() as demo:
|
24 |
+
# gallery = gr.Gallery(
|
25 |
+
# label="Generated images", show_label=False, elem_id="gallery",
|
26 |
+
# columns=[1], rows=[1], object_fit="contain", height="auto")
|
27 |
+
# btn = gr.Button("Generate images", scale=0)
|
28 |
+
#
|
29 |
+
# btn.click(get_prompt, 'text', gallery)
|
30 |
+
#
|
31 |
+
# demo.launch()
|
32 |
+
|
33 |
+
def get_prompt(prompt):
|
34 |
+
print('prompt:', prompt)
|
35 |
+
print('calling diffusion lens')
|
36 |
+
|
37 |
+
for skip_layers in range(24): # loop from 0 to 23
|
38 |
+
image = get_images(prompt, skip_layers=skip_layers)
|
39 |
+
gallery.update(image) # update the gallery with the new image
|
40 |
+
|
41 |
+
return "Images generated"
|
42 |
+
|
43 |
if __name__ == '__main__':
|
44 |
with gr.Blocks() as demo:
|
45 |
gallery = gr.Gallery(
|
46 |
label="Generated images", show_label=False, elem_id="gallery",
|
47 |
+
columns=[6], rows=[4], object_fit="contain", height="auto") # set rows to 24 to accommodate all images
|
48 |
btn = gr.Button("Generate images", scale=0)
|
49 |
|
50 |
btn.click(get_prompt, 'text', gallery)
|