Spaces:
Running
on
T4
Running
on
T4
Krebzonide
commited on
Commit
·
9c70ba0
1
Parent(s):
dba8477
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from diffusers import AutoPipelineForText2Image, StableDiffusionImg2ImgPipeline
|
2 |
-
|
3 |
import gradio as gr
|
4 |
import random
|
5 |
import torch
|
@@ -18,18 +18,16 @@ css = """
|
|
18 |
def generate(prompt, samp_steps, seed, progress=gr.Progress(track_tqdm=True)):
|
19 |
if seed < 0:
|
20 |
seed = random.randint(1,999999)
|
21 |
-
|
22 |
prompt,
|
23 |
num_inference_steps=1,
|
24 |
guidance_scale=0.0,
|
25 |
generator=torch.manual_seed(seed),
|
26 |
-
output_type="latent"
|
27 |
).images[0]
|
28 |
-
|
29 |
-
upscaled_latent = F.interpolate(latent, scale_factor=2)
|
30 |
final_image = img2img(
|
31 |
prompt,
|
32 |
-
|
33 |
num_inference_steps=int(samp_steps*2),
|
34 |
guidance_scale=5,
|
35 |
strength=0.5,
|
|
|
1 |
from diffusers import AutoPipelineForText2Image, StableDiffusionImg2ImgPipeline
|
2 |
+
from PIL import Image
|
3 |
import gradio as gr
|
4 |
import random
|
5 |
import torch
|
|
|
18 |
def generate(prompt, samp_steps, seed, progress=gr.Progress(track_tqdm=True)):
|
19 |
if seed < 0:
|
20 |
seed = random.randint(1,999999)
|
21 |
+
image = txt2img(
|
22 |
prompt,
|
23 |
num_inference_steps=1,
|
24 |
guidance_scale=0.0,
|
25 |
generator=torch.manual_seed(seed),
|
|
|
26 |
).images[0]
|
27 |
+
upscaled_image = image.resize((1024,1024), 1)
|
|
|
28 |
final_image = img2img(
|
29 |
prompt,
|
30 |
+
upscaled_image,
|
31 |
num_inference_steps=int(samp_steps*2),
|
32 |
guidance_scale=5,
|
33 |
strength=0.5,
|