Spaces:
Runtime error
Runtime error
Commit
·
8f7fbb5
1
Parent(s):
c74d460
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,12 +20,12 @@ css = """
|
|
| 20 |
def generate(prompt, samp_steps, seed, strength, progress=gr.Progress(track_tqdm=True)):
|
| 21 |
if seed < 0:
|
| 22 |
seed = random.randint(1,999999)
|
| 23 |
-
|
| 24 |
-
prompt,
|
| 25 |
-
|
| 26 |
-
guidance_scale=0.0,
|
| 27 |
-
generator=torch.manual_seed(seed),
|
| 28 |
-
).images[0]
|
| 29 |
imarray = numpy.random.rand(512,512,3) * 255
|
| 30 |
image = Image.fromarray(imarray.astype('uint8')).convert('RGBA')
|
| 31 |
upscaled_image = image.resize((1024,1024), 1)
|
|
@@ -40,12 +40,12 @@ def generate(prompt, samp_steps, seed, strength, progress=gr.Progress(track_tqdm
|
|
| 40 |
return [final_image], seed
|
| 41 |
|
| 42 |
def set_base_models():
|
| 43 |
-
txt2img = AutoPipelineForText2Image.from_pretrained(
|
| 44 |
-
"stabilityai/sdxl-turbo",
|
| 45 |
-
torch_dtype = torch.float16,
|
| 46 |
-
variant = "fp16"
|
| 47 |
-
)
|
| 48 |
-
txt2img.to("cuda")
|
| 49 |
img2img = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 50 |
"Lykon/dreamshaper-8",
|
| 51 |
torch_dtype = torch.float16,
|
|
@@ -53,7 +53,7 @@ def set_base_models():
|
|
| 53 |
safety_checker=None
|
| 54 |
)
|
| 55 |
img2img.to("cuda")
|
| 56 |
-
return
|
| 57 |
|
| 58 |
with gr.Blocks(css=css) as demo:
|
| 59 |
with gr.Column():
|
|
|
|
| 20 |
def generate(prompt, samp_steps, seed, strength, progress=gr.Progress(track_tqdm=True)):
|
| 21 |
if seed < 0:
|
| 22 |
seed = random.randint(1,999999)
|
| 23 |
+
# image = txt2img(
|
| 24 |
+
# prompt,
|
| 25 |
+
# num_inference_steps=1,
|
| 26 |
+
# guidance_scale=0.0,
|
| 27 |
+
# generator=torch.manual_seed(seed),
|
| 28 |
+
# ).images[0]
|
| 29 |
imarray = numpy.random.rand(512,512,3) * 255
|
| 30 |
image = Image.fromarray(imarray.astype('uint8')).convert('RGBA')
|
| 31 |
upscaled_image = image.resize((1024,1024), 1)
|
|
|
|
| 40 |
return [final_image], seed
|
| 41 |
|
| 42 |
def set_base_models():
|
| 43 |
+
# txt2img = AutoPipelineForText2Image.from_pretrained(
|
| 44 |
+
# "stabilityai/sdxl-turbo",
|
| 45 |
+
# torch_dtype = torch.float16,
|
| 46 |
+
# variant = "fp16"
|
| 47 |
+
# )
|
| 48 |
+
# txt2img.to("cuda")
|
| 49 |
img2img = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 50 |
"Lykon/dreamshaper-8",
|
| 51 |
torch_dtype = torch.float16,
|
|
|
|
| 53 |
safety_checker=None
|
| 54 |
)
|
| 55 |
img2img.to("cuda")
|
| 56 |
+
return None, img2img
|
| 57 |
|
| 58 |
with gr.Blocks(css=css) as demo:
|
| 59 |
with gr.Column():
|