Spaces:
Runtime error
Runtime error
examples
Browse files
app.py
CHANGED
|
@@ -20,6 +20,21 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
| 20 |
IMAGE_SIZE = 1024
|
| 21 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
pipe = FluxInpaintPipeline.from_pretrained(
|
| 24 |
"black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to(DEVICE)
|
| 25 |
|
|
@@ -157,6 +172,25 @@ with gr.Blocks() as demo:
|
|
| 157 |
with gr.Accordion("Debug", open=False):
|
| 158 |
output_mask_component = gr.Image(
|
| 159 |
type='pil', image_mode='RGB', label='Input mask')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
submit_button_component.click(
|
| 162 |
fn=process,
|
|
|
|
| 20 |
IMAGE_SIZE = 1024
|
| 21 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 22 |
|
| 23 |
+
EXAMPLES = [
|
| 24 |
+
[
|
| 25 |
+
{
|
| 26 |
+
"background": "https://media.roboflow.com/spaces/doge-2-image.jpeg",
|
| 27 |
+
"layers": ["https://media.roboflow.com/spaces/doge-2-mask.png"],
|
| 28 |
+
"composite": None
|
| 29 |
+
},
|
| 30 |
+
"spider tattoo",
|
| 31 |
+
42,
|
| 32 |
+
False,
|
| 33 |
+
0.9,
|
| 34 |
+
30
|
| 35 |
+
]
|
| 36 |
+
]
|
| 37 |
+
|
| 38 |
pipe = FluxInpaintPipeline.from_pretrained(
|
| 39 |
"black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to(DEVICE)
|
| 40 |
|
|
|
|
| 172 |
with gr.Accordion("Debug", open=False):
|
| 173 |
output_mask_component = gr.Image(
|
| 174 |
type='pil', image_mode='RGB', label='Input mask')
|
| 175 |
+
with gr.Row():
|
| 176 |
+
gr.Examples(
|
| 177 |
+
fn=process,
|
| 178 |
+
examples=EXAMPLES,
|
| 179 |
+
inputs=[
|
| 180 |
+
input_image_editor_component,
|
| 181 |
+
input_text_component,
|
| 182 |
+
seed_slicer_component,
|
| 183 |
+
randomize_seed_checkbox_component,
|
| 184 |
+
strength_slider_component,
|
| 185 |
+
num_inference_steps_slider_component
|
| 186 |
+
],
|
| 187 |
+
outputs=[
|
| 188 |
+
output_image_component,
|
| 189 |
+
output_mask_component
|
| 190 |
+
],
|
| 191 |
+
run_on_click=True,
|
| 192 |
+
cache_examples=True
|
| 193 |
+
)
|
| 194 |
|
| 195 |
submit_button_component.click(
|
| 196 |
fn=process,
|