Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,7 +73,13 @@ CACHE_EXAMPLES = torch.cuda.is_available() and os.getenv("CACHE_EXAMPLES", "0")
|
|
| 73 |
|
| 74 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
# Convert mm to pixels for a specific DPI (300)
|
| 79 |
def mm_to_pixels(mm, dpi=300):
|
|
@@ -150,7 +156,7 @@ def generate(
|
|
| 150 |
"guidance_scale": guidance_scale,
|
| 151 |
"num_inference_steps": 25,
|
| 152 |
"generator": generator,
|
| 153 |
-
"num_images_per_prompt":
|
| 154 |
"output_type": "pil",
|
| 155 |
}
|
| 156 |
|
|
|
|
| 73 |
|
| 74 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 75 |
|
| 76 |
+
# Initialize the DiffusionPipeline (this was missing)
|
| 77 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 78 |
+
"SG161222/RealVisXL_V3.0_Turbo", # or any model of your choice
|
| 79 |
+
torch_dtype=torch.float16,
|
| 80 |
+
use_safetensors=True,
|
| 81 |
+
variant="fp16"
|
| 82 |
+
).to(device)
|
| 83 |
|
| 84 |
# Convert mm to pixels for a specific DPI (300)
|
| 85 |
def mm_to_pixels(mm, dpi=300):
|
|
|
|
| 156 |
"guidance_scale": guidance_scale,
|
| 157 |
"num_inference_steps": 25,
|
| 158 |
"generator": generator,
|
| 159 |
+
"num_images_per_prompt": 6, # Max 6 images
|
| 160 |
"output_type": "pil",
|
| 161 |
}
|
| 162 |
|