Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,27 @@
|
|
1 |
-
|
2 |
-
from transformers import pipeline
|
3 |
-
from PIL import Image
|
4 |
-
import requests
|
5 |
-
pip install transformers torch
|
6 |
|
7 |
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
st.title("Image Classification")
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
if __name__ == "__main__":
|
26 |
-
main()
|
|
|
1 |
+
pip install invisible_watermark transformers accelerate safetensors
|
|
|
|
|
|
|
|
|
2 |
|
3 |
|
4 |
+
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
|
5 |
|
6 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
7 |
+
"hotshotco/SDXL-512",
|
8 |
+
use_safetensors=True,
|
9 |
+
).to('cuda')
|
10 |
|
11 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
|
|
12 |
|
13 |
+
prompt = "a woman laughing"
|
14 |
+
negative_prompt = ""
|
15 |
+
|
16 |
+
image = pipe(
|
17 |
+
prompt,
|
18 |
+
negative_prompt=negative_prompt,
|
19 |
+
width=512,
|
20 |
+
height=512,
|
21 |
+
target_size=(1024, 1024),
|
22 |
+
original_size=(4096, 4096),
|
23 |
+
num_inference_steps=50
|
24 |
+
).images[0]
|
25 |
+
|
26 |
+
image.save("woman_laughing.png")
|
27 |
|
|
|
|