Spaces:
Paused
Paused
Commit
·
f0552b8
1
Parent(s):
4e2e5c2
Update app1.py
Browse files
app1.py
CHANGED
@@ -5,34 +5,8 @@ import modin.pandas as pd
|
|
5 |
from PIL import Image
|
6 |
from diffusers import DiffusionPipeline, StableDiffusionLatentUpscalePipeline
|
7 |
|
8 |
-
css = """
|
9 |
-
<style>
|
10 |
-
.finetuned-diffusion-div {
|
11 |
-
text-align: center;
|
12 |
-
max-width: 700px;
|
13 |
-
margin: 0 auto;
|
14 |
-
}
|
15 |
-
.finetuned-diffusion-div div {
|
16 |
-
display: inline-flex;
|
17 |
-
align-items: center;
|
18 |
-
gap: 0.8rem;
|
19 |
-
font-size: 1.75rem;
|
20 |
-
}
|
21 |
-
.finetuned-diffusion-div div h1 {
|
22 |
-
font-weight: 900;
|
23 |
-
margin-bottom: 7px;
|
24 |
-
}
|
25 |
-
.finetuned-diffusion-div p {
|
26 |
-
margin-bottom: 10px;
|
27 |
-
font-size: 94%;
|
28 |
-
}
|
29 |
-
.finetuned-diffusion-div p a {
|
30 |
-
text-decoration: underline;
|
31 |
-
}
|
32 |
-
</style>
|
33 |
-
|
34 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
35 |
-
pipe = DiffusionPipeline.from_pretrained("dreamlike-art/dreamlike-photoreal-2.0", torch_dtype=torch.float16, safety_checker=None)
|
36 |
upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
|
37 |
upscaler = upscaler.to(device)
|
38 |
pipe = pipe.to(device)
|
@@ -46,21 +20,21 @@ def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale,
|
|
46 |
image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0]
|
47 |
return image
|
48 |
|
49 |
-
gr.Interface(theme='
|
50 |
gr.Textbox(label='What You dont want (Negative Prompt)'),
|
51 |
gr.Slider(512, 1024, 768, step=128, label='Height'),
|
52 |
gr.Slider(512, 1024, 768, step=128, label='Width'),
|
53 |
gr.Slider(1, maximum=15, value=10, step=.25),
|
54 |
gr.Slider(25, maximum=100, value=50, step=25),
|
55 |
gr.Slider(minimum=1, step=1, maximum=9999999999999999, randomize=True),
|
56 |
-
|
57 |
-
gr.Textbox(label='Upscaler Prompt: Optional'),
|
58 |
-
gr.Textbox(label='Upscaler Negative Prompt: Both Optional And Experimental'),
|
59 |
-
gr.Slider(minimum=0, maximum=15, value=0, step=1, label='Upscale Guidance Scale'),
|
60 |
-
gr.Slider(minimum=5, maximum=25, value=5, step=5, label='Upscaler Iterations')
|
61 |
|
62 |
],
|
63 |
outputs=gr.Image(label='Generated Image'),
|
64 |
-
title="
|
65 |
-
description="<br
|
66 |
-
|
|
|
5 |
from PIL import Image
|
6 |
from diffusers import DiffusionPipeline, StableDiffusionLatentUpscalePipeline
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
+
pipe = DiffusionPipeline.from_pretrained("dreamlike-art/dreamlike-photoreal-2.0", torch_dtype=torch.float16, safety_checker=None, use_safetensors=False)
|
10 |
upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
|
11 |
upscaler = upscaler.to(device)
|
12 |
pipe = pipe.to(device)
|
|
|
20 |
image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0]
|
21 |
return image
|
22 |
|
23 |
+
gr.Interface(theme='ParityError/Anime', fn=genie, inputs=[gr.Textbox(label='Input field right under here(Prompt)'),
|
24 |
gr.Textbox(label='What You dont want (Negative Prompt)'),
|
25 |
gr.Slider(512, 1024, 768, step=128, label='Height'),
|
26 |
gr.Slider(512, 1024, 768, step=128, label='Width'),
|
27 |
gr.Slider(1, maximum=15, value=10, step=.25),
|
28 |
gr.Slider(25, maximum=100, value=50, step=25),
|
29 |
gr.Slider(minimum=1, step=1, maximum=9999999999999999, randomize=True),
|
30 |
+
# gr.Radio(["Yes", "No"], label='Upscale?'),
|
31 |
+
#gr.Textbox(label='Upscaler Prompt: Optional'),
|
32 |
+
#gr.Textbox(label='Upscaler Negative Prompt: Both Optional And Experimental'),
|
33 |
+
#gr.Slider(minimum=0, maximum=15, value=0, step=1, label='Upscale Guidance Scale'),
|
34 |
+
#gr.Slider(minimum=5, maximum=25, value=5, step=5, label='Upscaler Iterations')
|
35 |
|
36 |
],
|
37 |
outputs=gr.Image(label='Generated Image'),
|
38 |
+
title="Dream Art (SD) ",
|
39 |
+
description="<br> <h4> <div style='width:100%'> Info:Dream Art (SD) <br> This App is our favorite now and shows how Stable diffusion works i a good way !</h4> </div>",
|
40 |
+
).launch(debug=True, max_threads=True)
|