Update app.py
Browse files
app.py
CHANGED
|
@@ -6,23 +6,13 @@ import random
|
|
| 6 |
import time
|
| 7 |
from diffusers import AutoPipelineForText2Image
|
| 8 |
from diffusers import AutoPipelineForImage2Image
|
| 9 |
-
|
| 10 |
from diffusers.utils import load_image
|
| 11 |
pipeline_text2image = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo").to("cuda")
|
| 12 |
pipeline_image2image = AutoPipelineForImage2Image.from_pipe(pipeline_text2image).to("cuda")
|
| 13 |
-
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to("cuda")
|
| 14 |
|
| 15 |
def text2img(prompt = "A cinematic shot of a baby racoon wearing an intricate italian priest robe.",model="flux",guidance_scale=0.0, num_inference_steps=1):
|
| 16 |
-
|
| 17 |
-
image = pipe(
|
| 18 |
-
prompt,
|
| 19 |
-
guidance_scale=guidance_scale,
|
| 20 |
-
num_inference_steps=num_inference_steps,
|
| 21 |
-
max_sequence_length=256,
|
| 22 |
-
generator=torch.Generator("cpu").manual_seed(0)
|
| 23 |
-
).images[0]
|
| 24 |
-
else:
|
| 25 |
-
image = pipeline_text2image(prompt=prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
|
| 26 |
return image
|
| 27 |
|
| 28 |
def img2img(image,prompt="A cinematic shot of a baby racoon wearing an intricate italian priest robe.", guidance_scale=0.0, num_inference_steps=1,strength=0.5):
|
|
|
|
| 6 |
import time
|
| 7 |
from diffusers import AutoPipelineForText2Image
|
| 8 |
from diffusers import AutoPipelineForImage2Image
|
| 9 |
+
|
| 10 |
from diffusers.utils import load_image
|
| 11 |
pipeline_text2image = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo").to("cuda")
|
| 12 |
pipeline_image2image = AutoPipelineForImage2Image.from_pipe(pipeline_text2image).to("cuda")
|
|
|
|
| 13 |
|
| 14 |
def text2img(prompt = "A cinematic shot of a baby racoon wearing an intricate italian priest robe.",model="flux",guidance_scale=0.0, num_inference_steps=1):
|
| 15 |
+
image = pipeline_text2image(prompt=prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
return image
|
| 17 |
|
| 18 |
def img2img(image,prompt="A cinematic shot of a baby racoon wearing an intricate italian priest robe.", guidance_scale=0.0, num_inference_steps=1,strength=0.5):
|