Spaces:
Runtime error
Runtime error
Commit
·
badee21
1
Parent(s):
81223b7
Minor updates
Browse files
app.py
CHANGED
|
@@ -78,11 +78,11 @@ def get_guide(image):
|
|
| 78 |
def create_demo(max_images=12, default_num_images=3):
|
| 79 |
with gr.Blocks(theme=gr.themes.Default(font=[gr.themes.GoogleFont("IBM Plex Mono"), "ui-monospace","monospace"]), css=css) as demo:
|
| 80 |
|
| 81 |
-
gr.Markdown('#
|
| 82 |
with gr.Accordion('Instructions', open=False):
|
| 83 |
-
gr.Markdown('##
|
| 84 |
gr.Markdown('1. Upload your image below')
|
| 85 |
-
gr.Markdown('2. **Draw the mask** for the region you want changed (
|
| 86 |
gr.Markdown('3. Click `Set Mask` when it is ready!')
|
| 87 |
gr.Markdown('## Sketch ✏️')
|
| 88 |
gr.Markdown('4. Now, you can **sketch a replacement** object! (Sketch ✏️)')
|
|
@@ -100,7 +100,7 @@ def create_demo(max_images=12, default_num_images=3):
|
|
| 100 |
shape=[HEIGHT,WIDTH],
|
| 101 |
type='numpy',
|
| 102 |
elem_classes="image_upload",
|
| 103 |
-
label='Mask Draw (
|
| 104 |
tool='sketch',
|
| 105 |
brush_radius=60).style(height=500)
|
| 106 |
input_image=image
|
|
@@ -125,32 +125,32 @@ def create_demo(max_images=12, default_num_images=3):
|
|
| 125 |
show_label=False,
|
| 126 |
elem_id="output_image",
|
| 127 |
).style(height=500,containter=True)
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
|
| 151 |
with gr.Accordion('More Info', open=False):
|
| 152 |
gr.Markdown('This demo was created by Mikolaj Czerkawski [@mikonvergence](https://twitter.com/mikonvergence) based on the 🌱 open-source implementation of [ControlNetInpaint](https://github.com/mikonvergence/ControlNetInpaint) (diffusers-friendly!).')
|
| 153 |
-
gr.Markdown('The tool currently only works with image resolution of 512px.')
|
| 154 |
gr.Markdown('💡 To learn more about diffusion with interactive code, check out my open-source ⏩[DiffusionFastForward](https://github.com/mikonvergence/DiffusionFastForward) course. It contains example code, executable notebooks, videos, notes, and a few use cases for training from scratch!')
|
| 155 |
|
| 156 |
inputs = [
|
|
|
|
| 78 |
def create_demo(max_images=12, default_num_images=3):
|
| 79 |
with gr.Blocks(theme=gr.themes.Default(font=[gr.themes.GoogleFont("IBM Plex Mono"), "ui-monospace","monospace"]), css=css) as demo:
|
| 80 |
|
| 81 |
+
gr.Markdown('# Mask and Sketch ✂️▶️✏️')
|
| 82 |
with gr.Accordion('Instructions', open=False):
|
| 83 |
+
gr.Markdown('## Mask ✂️')
|
| 84 |
gr.Markdown('1. Upload your image below')
|
| 85 |
+
gr.Markdown('2. **Draw the mask** for the region you want changed (Mask ✂️)')
|
| 86 |
gr.Markdown('3. Click `Set Mask` when it is ready!')
|
| 87 |
gr.Markdown('## Sketch ✏️')
|
| 88 |
gr.Markdown('4. Now, you can **sketch a replacement** object! (Sketch ✏️)')
|
|
|
|
| 100 |
shape=[HEIGHT,WIDTH],
|
| 101 |
type='numpy',
|
| 102 |
elem_classes="image_upload",
|
| 103 |
+
label='Mask Draw (Mask!)',
|
| 104 |
tool='sketch',
|
| 105 |
brush_radius=60).style(height=500)
|
| 106 |
input_image=image
|
|
|
|
| 125 |
show_label=False,
|
| 126 |
elem_id="output_image",
|
| 127 |
).style(height=500,containter=True)
|
| 128 |
+
with gr.Accordion('Advanced options', open=False):
|
| 129 |
+
num_steps = gr.Slider(label='Steps',
|
| 130 |
+
minimum=1,
|
| 131 |
+
maximum=100,
|
| 132 |
+
value=20,
|
| 133 |
+
step=1)
|
| 134 |
+
text_scale = gr.Slider(label='Text Guidance Scale',
|
| 135 |
+
minimum=0.1,
|
| 136 |
+
maximum=30.0,
|
| 137 |
+
value=7.5,
|
| 138 |
+
step=0.1)
|
| 139 |
+
seed = gr.Slider(label='Seed',
|
| 140 |
+
minimum=-1,
|
| 141 |
+
maximum=2147483647,
|
| 142 |
+
step=1,
|
| 143 |
+
randomize=True)
|
| 144 |
+
|
| 145 |
+
sketch_scale = gr.Slider(label='Sketch Guidance Scale',
|
| 146 |
+
minimum=0.0,
|
| 147 |
+
maximum=1.0,
|
| 148 |
+
value=1.0,
|
| 149 |
+
step=0.05)
|
| 150 |
|
| 151 |
with gr.Accordion('More Info', open=False):
|
| 152 |
gr.Markdown('This demo was created by Mikolaj Czerkawski [@mikonvergence](https://twitter.com/mikonvergence) based on the 🌱 open-source implementation of [ControlNetInpaint](https://github.com/mikonvergence/ControlNetInpaint) (diffusers-friendly!).')
|
| 153 |
+
gr.Markdown('**Limitation** The tool currently only works with image resolution of 512px. You need to click reload button to draw a new mask after the previous generation since gradio does not allow to control it from software.')
|
| 154 |
gr.Markdown('💡 To learn more about diffusion with interactive code, check out my open-source ⏩[DiffusionFastForward](https://github.com/mikonvergence/DiffusionFastForward) course. It contains example code, executable notebooks, videos, notes, and a few use cases for training from scratch!')
|
| 155 |
|
| 156 |
inputs = [
|