Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
|
3 |
+
# Doc / guide: https://huggingface.co/docs/hub/model-cards
|
4 |
+
{}
|
5 |
+
---
|
6 |
+
|
7 |
+
# Model Card for Model ID
|
8 |
+
|
9 |
+
copy/paste/save as inference.py
|
10 |
+
```
|
11 |
+
from diffusers import DiffusionPipeline
|
12 |
+
import argparse
|
13 |
+
|
14 |
+
# Parse command line arguments
|
15 |
+
parser = argparse.ArgumentParser(description='Generate an image using a Hugging Face diffusion model')
|
16 |
+
parser.add_argument('--model', type=str, default="uisikdag/ddpm-few-shot-art-painting",
|
17 |
+
help='Hugging Face model name/path')
|
18 |
+
parser.add_argument('--steps', type=int, default=500,
|
19 |
+
help='Number of inference steps')
|
20 |
+
args = parser.parse_args()
|
21 |
+
|
22 |
+
# Load the model
|
23 |
+
generator = DiffusionPipeline.from_pretrained(args.model).to("cuda")
|
24 |
+
|
25 |
+
# Generate image
|
26 |
+
image = generator(num_inference_steps=args.steps).images[0]
|
27 |
+
|
28 |
+
# Save the image with model name in the filename
|
29 |
+
output_filename = f"output_{args.model.split('/')[-1]}.png"
|
30 |
+
image.save(output_filename)
|
31 |
+
print(f"Image saved as {output_filename}")
|
32 |
+
```
|
33 |
+
python inference.py
|