Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,3 +19,22 @@ pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
|
| 19 |
|
| 20 |
def colorize(image):
|
| 21 |
prompt = (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
def colorize(image):
|
| 21 |
prompt = (
|
| 22 |
+
"colorize the sketch while strictly preserving the original line art, "
|
| 23 |
+
"do not add clothing, keep the torso exactly as drawn, leather jacket only"
|
| 24 |
+
)
|
| 25 |
+
result = pipe(
|
| 26 |
+
prompt=prompt,
|
| 27 |
+
image=image,
|
| 28 |
+
num_inference_steps=20,
|
| 29 |
+
guidance_scale=3.0
|
| 30 |
+
).images[0]
|
| 31 |
+
return result
|
| 32 |
+
|
| 33 |
+
demo = gr.Interface(
|
| 34 |
+
fn=colorize,
|
| 35 |
+
inputs=gr.Image(type='pil'),
|
| 36 |
+
outputs=gr.Image(type='pil'),
|
| 37 |
+
title="Sketch Colorizer (CPU Optimized)"
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
demo.launch()
|