Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,14 +13,14 @@ generator = torch.Generator(device='cpu')
|
|
| 13 |
pipe = StableDiffusionPipeline.from_pretrained("bariscal/cbst_style", safety_checker=None)
|
| 14 |
|
| 15 |
def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_inference_steps=50, guidance_scale=7.5):
|
| 16 |
-
with torch.inference_mode():
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
with gr.Row():
|
|
|
|
| 13 |
pipe = StableDiffusionPipeline.from_pretrained("bariscal/cbst_style", safety_checker=None)
|
| 14 |
|
| 15 |
def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_inference_steps=50, guidance_scale=7.5):
|
| 16 |
+
#with torch.inference_mode():
|
| 17 |
+
return pipe(
|
| 18 |
+
prompt, height=int(height), width=int(width),
|
| 19 |
+
negative_prompt=negative_prompt,
|
| 20 |
+
num_images_per_prompt=int(num_samples),
|
| 21 |
+
num_inference_steps=int(num_inference_steps), guidance_scale=guidance_scale,
|
| 22 |
+
generator="cpu" # Use the CPU for inference
|
| 23 |
+
).images
|
| 24 |
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
with gr.Row():
|