Update README.md
Browse files
README.md
CHANGED
@@ -29,5 +29,30 @@ class TrainingConfig:
|
|
29 |
|
30 |
config = TrainingConfig()
|
31 |
```
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
|
|
29 |
|
30 |
config = TrainingConfig()
|
31 |
```
|
32 |
+
|
33 |
+
copy/paste/save as inference.py
|
34 |
+
```
|
35 |
+
from diffusers import DiffusionPipeline
|
36 |
+
import argparse
|
37 |
+
|
38 |
+
# Parse command line arguments
|
39 |
+
parser = argparse.ArgumentParser(description='Generate an image using a Hugging Face diffusion model')
|
40 |
+
parser.add_argument('--model', type=str, default="uisikdag/ddpm-few-shot-art-painting",
|
41 |
+
help='Hugging Face model name/path')
|
42 |
+
parser.add_argument('--steps', type=int, default=500,
|
43 |
+
help='Number of inference steps')
|
44 |
+
args = parser.parse_args()
|
45 |
+
|
46 |
+
# Load the model
|
47 |
+
generator = DiffusionPipeline.from_pretrained(args.model).to("cuda")
|
48 |
+
|
49 |
+
# Generate image
|
50 |
+
image = generator(num_inference_steps=args.steps).images[0]
|
51 |
+
|
52 |
+
# Save the image with model name in the filename
|
53 |
+
output_filename = f"output_{args.model.split('/')[-1]}.png"
|
54 |
+
image.save(output_filename)
|
55 |
+
print(f"Image saved as {output_filename}")
|
56 |
+
```
|
57 |
+
python inference.py --model="uisikdag/ddpm-robin-plus-old" --steps 1000
|
58 |
|