Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import time
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
import diffusers
|
|
@@ -36,7 +37,7 @@ with gr.Blocks() as demo:
|
|
| 36 |
else:
|
| 37 |
print("Left Image is merged!")
|
| 38 |
|
| 39 |
-
|
| 40 |
def generate(prompt, seed, steps, height_width, negative_prompt, guidance_scale, method):
|
| 41 |
|
| 42 |
pipe.enable_xformers_memory_efficient_attention()
|
|
@@ -112,12 +113,10 @@ with gr.Blocks() as demo:
|
|
| 112 |
|
| 113 |
which_image(final_img, width=height_width)
|
| 114 |
|
| 115 |
-
|
| 116 |
-
result = f"Baseline image: {end_time_base-start_time_base:.2f} sec | {'ToDo' if method == 'todo' else 'ToMe'} image: {end_time_merge-start_time_merge:.2f} sec"
|
| 117 |
|
| 118 |
return final_img, result
|
| 119 |
|
| 120 |
-
|
| 121 |
gen.click(generate, inputs=[prompt, seed, steps, height_width, negative_prompt,
|
| 122 |
guidance_scale, method], outputs=[output_image, result])
|
| 123 |
|
|
|
|
| 1 |
import time
|
| 2 |
+
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
import diffusers
|
|
|
|
| 37 |
else:
|
| 38 |
print("Left Image is merged!")
|
| 39 |
|
| 40 |
+
@spaces.GPU
|
| 41 |
def generate(prompt, seed, steps, height_width, negative_prompt, guidance_scale, method):
|
| 42 |
|
| 43 |
pipe.enable_xformers_memory_efficient_attention()
|
|
|
|
| 113 |
|
| 114 |
which_image(final_img, width=height_width)
|
| 115 |
|
| 116 |
+
result = f"Baseline image: {end_time_base-start_time_base:.2f} sec | {'ToDo' if method == 'todo' else 'ToMe'} image: {end_time_merge-start_time_merge:.2f} sec"
|
|
|
|
| 117 |
|
| 118 |
return final_img, result
|
| 119 |
|
|
|
|
| 120 |
gen.click(generate, inputs=[prompt, seed, steps, height_width, negative_prompt,
|
| 121 |
guidance_scale, method], outputs=[output_image, result])
|
| 122 |
|