Spaces:
Runtime error
Runtime error
Commit ·
09fb2db
1
Parent(s): 3b7a372
add
Browse files- inference.py +15 -0
inference.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import StableDiffusionPipeline
|
| 2 |
+
import torch
|
| 3 |
+
|
| 4 |
+
# Load the fine-tuned DreamBooth model
|
| 5 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 6 |
+
"./nyc-ad-model",
|
| 7 |
+
torch_dtype=torch.float16,
|
| 8 |
+
).to("cuda") # use "cpu" if no GPU
|
| 9 |
+
|
| 10 |
+
prompt = "fried chicken advertisement poster: a fried chicken in brooklyn street"
|
| 11 |
+
image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]
|
| 12 |
+
|
| 13 |
+
# Display or save the image
|
| 14 |
+
image.save("output_nyc_ad.png")
|
| 15 |
+
image.show()
|