Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image, AutoencoderKL
|
| 3 |
from diffusers.utils import load_image
|
|
@@ -13,7 +14,7 @@ image_pipeline = AutoPipelineForImage2Image.from_pretrained("stabilityai/stable-
|
|
| 13 |
image_pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
| 14 |
image_pipeline.set_ip_adapter_scale(0.6)
|
| 15 |
|
| 16 |
-
|
| 17 |
def text_to_image(ip, prompt, neg_prompt, width, height, ip_scale, strength, guidance, steps):
|
| 18 |
ip.thumbnail((1024, 1024))
|
| 19 |
|
|
@@ -32,7 +33,7 @@ def text_to_image(ip, prompt, neg_prompt, width, height, ip_scale, strength, gui
|
|
| 32 |
|
| 33 |
return images[0]
|
| 34 |
|
| 35 |
-
|
| 36 |
def image_to_image(ip, image, prompt, neg_prompt, width, height, ip_scale, strength, guidance, steps):
|
| 37 |
ip.thumbnail((1024, 1024))
|
| 38 |
image.thumbnail((1024, 1024))
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image, AutoencoderKL
|
| 4 |
from diffusers.utils import load_image
|
|
|
|
| 14 |
image_pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
| 15 |
image_pipeline.set_ip_adapter_scale(0.6)
|
| 16 |
|
| 17 |
+
@spaces.GPU(enable_queue=True)
|
| 18 |
def text_to_image(ip, prompt, neg_prompt, width, height, ip_scale, strength, guidance, steps):
|
| 19 |
ip.thumbnail((1024, 1024))
|
| 20 |
|
|
|
|
| 33 |
|
| 34 |
return images[0]
|
| 35 |
|
| 36 |
+
@spaces.GPU(enable_queue=True)
|
| 37 |
def image_to_image(ip, image, prompt, neg_prompt, width, height, ip_scale, strength, guidance, steps):
|
| 38 |
ip.thumbnail((1024, 1024))
|
| 39 |
image.thumbnail((1024, 1024))
|