Commit
·
989842c
1
Parent(s):
645f954
test space without diffusers
Browse files
app.py
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
-
from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
4 |
|
5 |
-
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
6 |
|
7 |
-
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5"
|
8 |
-
pipe = pipe.to(device)
|
9 |
|
10 |
def generate_image(prompt, negative_prompt, seed, guidance_scale, num_inference_steps):
|
11 |
|
|
|
12 |
generator = torch.Generator().manual_seed(seed)
|
13 |
|
14 |
image = pipe(
|
@@ -22,6 +23,8 @@ def generate_image(prompt, negative_prompt, seed, guidance_scale, num_inference_
|
|
22 |
).images[0]
|
23 |
|
24 |
return image
|
|
|
|
|
25 |
|
26 |
css="""
|
27 |
#col-container {
|
@@ -40,8 +43,6 @@ with gr.Blocks(css=css) as demo:
|
|
40 |
### References
|
41 |
- [Coding Stable Diffusion from scratch in PyTorch](https://www.youtube.com/watch?v=ZBKpAp_6TGI&ab_channel=UmarJamil)
|
42 |
- [Hugging Space Diffusers](https://github.com/huggingface/diffusers/)
|
43 |
-
|
44 |
-
Currently running on {device}.
|
45 |
""")
|
46 |
|
47 |
with gr.Row():
|
|
|
1 |
import gradio as gr
|
2 |
+
# from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
4 |
|
5 |
+
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
6 |
|
7 |
+
# pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5-pruned-emaonly")
|
8 |
+
# pipe = pipe.to(device)
|
9 |
|
10 |
def generate_image(prompt, negative_prompt, seed, guidance_scale, num_inference_steps):
|
11 |
|
12 |
+
"""
|
13 |
generator = torch.Generator().manual_seed(seed)
|
14 |
|
15 |
image = pipe(
|
|
|
23 |
).images[0]
|
24 |
|
25 |
return image
|
26 |
+
"""
|
27 |
+
return torch.rand(512, 512, 3)
|
28 |
|
29 |
css="""
|
30 |
#col-container {
|
|
|
43 |
### References
|
44 |
- [Coding Stable Diffusion from scratch in PyTorch](https://www.youtube.com/watch?v=ZBKpAp_6TGI&ab_channel=UmarJamil)
|
45 |
- [Hugging Space Diffusers](https://github.com/huggingface/diffusers/)
|
|
|
|
|
46 |
""")
|
47 |
|
48 |
with gr.Row():
|