Spaces:
Paused
Paused
Commit
·
250aa6c
0
Parent(s):
Duplicate from Dagfinn1962/CPU
Browse files- .gitattributes +34 -0
- README.md +14 -0
- app.py +40 -0
- app1.py +40 -0
- requirements.txt +11 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: SD 2.1 CPU
|
3 |
+
emoji: 🐢
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: indigo
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.23.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
duplicated_from: Dagfinn1962/CPU
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
import numpy as np
|
4 |
+
import modin.pandas as pd
|
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)
|
10 |
+
upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
|
11 |
+
upscaler = upscaler.to(device)
|
12 |
+
pipe = pipe.to(device)
|
13 |
+
|
14 |
+
def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale, upscale_prompt, upscale_neg, upscale_scale, upscale_steps):
|
15 |
+
generator = torch.Generator(device=device).manual_seed(seed)
|
16 |
+
if upscale == "Yes":
|
17 |
+
low_res_latents = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images
|
18 |
+
image = upscaler(prompt=upscale_prompt, negative_prompt=upscale_neg, image=low_res_latents, num_inference_steps=upscale_steps, guidance_scale=upscale_scale, generator=generator).images[0]
|
19 |
+
else:
|
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="Daylight SD (CPU)",
|
39 |
+
description="<br> <h4> <div style='width:100%'> Info:Daylight SD (GPU) <br> This is a lightweight App mostly to show how Stable diffusion works.<br> Aichatbot.ai is a project into Image Creation with Stable Diffusion. <br> If you like our Apps Please consider signing up underneath. <br> We will speed up the Apps with a little contribution from Our Members.<br> PS! We are sorry to repeat but this app is also on Huggingface.co!</h4> </div>",
|
40 |
+
article = "Online App: <a href=\"https://www.aichatbot.ai\">www.aichatbot.ai</a>").launch(debug=True, max_threads=True)
|
app1.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
import numpy as np
|
4 |
+
import modin.pandas as pd
|
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)
|
10 |
+
upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
|
11 |
+
upscaler = upscaler.to(device)
|
12 |
+
pipe = pipe.to(device)
|
13 |
+
|
14 |
+
def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale, upscale_prompt, upscale_neg, upscale_scale, upscale_steps):
|
15 |
+
generator = torch.Generator(device=device).manual_seed(seed)
|
16 |
+
if upscale == "Yes":
|
17 |
+
low_res_latents = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images
|
18 |
+
image = upscaler(prompt=upscale_prompt, negative_prompt=upscale_neg, image=low_res_latents, num_inference_steps=upscale_steps, guidance_scale=upscale_scale, generator=generator).images[0]
|
19 |
+
else:
|
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='HaleyCH/HaleyCH_Theme', 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="Our Free Image Creator",
|
39 |
+
description="<br><br><b/> TIPS:<br>To get the best result read the instructions undeneath the App.<br> This Free App is slow producing Images.<br> Join us , And get access to this App and many more. They work faster and have more advanced features",
|
40 |
+
article = "Online App: <a href=\"https://www.aichatbot.ai\">www.aichatbot.ai</a>").launch(debug=True, max_threads=True)
|
requirements.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-f --extra-index-url https://download.pytorch.org/whl/cu116
|
2 |
+
torch
|
3 |
+
numpy
|
4 |
+
torchvision
|
5 |
+
git+https://github.com/huggingface/diffusers
|
6 |
+
transformers
|
7 |
+
accelerate
|
8 |
+
ftfy
|
9 |
+
xformers
|
10 |
+
modin[all]
|
11 |
+
gradio
|