Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,23 +13,6 @@ 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 |
return prompt
|
|
@@ -38,19 +21,20 @@ def get_prompt(prompt):
|
|
| 38 |
|
| 39 |
def generate_images(prompt):
|
| 40 |
print('calling diffusion lens')
|
| 41 |
-
|
|
|
|
| 42 |
image = get_images(prompt, skip_layers=skip_layers)
|
| 43 |
-
|
| 44 |
|
| 45 |
-
return
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
with gr.Blocks() as demo:
|
| 50 |
-
gallery = gr.Gallery(
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
btn = gr.Button("Generate images", scale=0)
|
| 54 |
-
text_input = gr.Interface(fn=get_prompt, inputs="text", outputs="
|
| 55 |
-
btn.click(generate_images, text_input, gallery) # pass the text input interface to btn.click()
|
| 56 |
-
demo.launch()
|
|
|
|
| 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 |
return prompt
|
|
|
|
| 21 |
|
| 22 |
def generate_images(prompt):
|
| 23 |
print('calling diffusion lens')
|
| 24 |
+
images = []
|
| 25 |
+
for skip_layers in range(1): # loop from 0 to 23
|
| 26 |
image = get_images(prompt, skip_layers=skip_layers)
|
| 27 |
+
images.append(image)
|
| 28 |
|
| 29 |
+
return images
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
with gr.Blocks() as demo:
|
| 34 |
+
# gallery = gr.Gallery(
|
| 35 |
+
# label="Generated images", show_label=False, elem_id="gallery",
|
| 36 |
+
# columns=[6], rows=[4], object_fit="contain", height="auto") # set rows to 24 to accommodate all images
|
| 37 |
+
# btn = gr.Button("Generate images", scale=0)
|
| 38 |
+
text_input = gr.Interface(fn=get_prompt, inputs="text", outputs=["image"] * 1)
|
| 39 |
+
# btn.click(generate_images, text_input, gallery) # pass the text input interface to btn.click()
|
| 40 |
+
demo.launch()
|