Spaces:
Runtime error
Runtime error
updated loop
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from diffusers import ControlNetModel, DiffusionPipeline
|
|
5 |
from diffusers.utils import load_image
|
6 |
import gradio as gr
|
7 |
import warnings
|
|
|
8 |
warnings.filterwarnings("ignore")
|
9 |
def resize_for_condition_image(input_image: Image, resolution: int):
|
10 |
input_image = input_image.convert("RGB")
|
@@ -26,6 +27,7 @@ pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",
|
|
26 |
torch_dtype=torch.float16).to(device)
|
27 |
#pipe.enable_xformers_memory_efficient_attention()
|
28 |
|
|
|
29 |
def super_esr(source_image,prompt,negative_prompt,strength,seed,num_inference_steps):
|
30 |
condition_image = resize_for_condition_image(source_image, 1024)
|
31 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
@@ -63,6 +65,10 @@ examples=[
|
|
63 |
["https://i.imgur.com/9IqyX1F.png","best quality","blur, lowres, bad anatomy, bad hands, cropped, worst quality",1.0,0,100],
|
64 |
]
|
65 |
# create a queue of the requests
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
68 |
|
|
|
5 |
from diffusers.utils import load_image
|
6 |
import gradio as gr
|
7 |
import warnings
|
8 |
+
import spaces
|
9 |
warnings.filterwarnings("ignore")
|
10 |
def resize_for_condition_image(input_image: Image, resolution: int):
|
11 |
input_image = input_image.convert("RGB")
|
|
|
27 |
torch_dtype=torch.float16).to(device)
|
28 |
#pipe.enable_xformers_memory_efficient_attention()
|
29 |
|
30 |
+
@spaces.GPU(enable_queue=True)
|
31 |
def super_esr(source_image,prompt,negative_prompt,strength,seed,num_inference_steps):
|
32 |
condition_image = resize_for_condition_image(source_image, 1024)
|
33 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
|
|
65 |
["https://i.imgur.com/9IqyX1F.png","best quality","blur, lowres, bad anatomy, bad hands, cropped, worst quality",1.0,0,100],
|
66 |
]
|
67 |
# create a queue of the requests
|
68 |
+
|
69 |
+
demo=gr.Interface(fn=super_esr,inputs=inputs,outputs=outputs,title=title,description=description,examples=examples)
|
70 |
+
|
71 |
+
|
72 |
+
if __name__ == "__main__":
|
73 |
+
demo.queue(max_size=20, api_open=False).launch(show_api=False)
|
74 |
|