Spaces:
Running on Zero
Running on Zero
HadiZayer commited on
Commit ·
d9ccc15
1
Parent(s): 3963656
download examples from Space repo at startup
Browse files
app.py
CHANGED
|
@@ -12,6 +12,22 @@ import numpy as np
|
|
| 12 |
# Download checkpoint from HF Hub at startup
|
| 13 |
checkpoint_path = hf_hub_download(repo_id="HadiZayer/MagicFixup", filename="magicfu_weights")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
magic_fixup = MagicFixup(model_path=checkpoint_path)
|
| 16 |
|
| 17 |
|
|
@@ -40,7 +56,7 @@ demo = gr.Interface(
|
|
| 40 |
gr.Image(type="pil", image_mode="RGBA", label="Coarse Edit (with alpha mask)"),
|
| 41 |
],
|
| 42 |
outputs=gr.Image(label="Result"),
|
| 43 |
-
examples=
|
| 44 |
title="Magic Fixup",
|
| 45 |
description="Upload your original image and a coarse edit (PNG with alpha channel marking the edited region). Magic Fixup will refine the edit to look photorealistic.",
|
| 46 |
)
|
|
|
|
| 12 |
# Download checkpoint from HF Hub at startup
|
| 13 |
checkpoint_path = hf_hub_download(repo_id="HadiZayer/MagicFixup", filename="magicfu_weights")
|
| 14 |
|
| 15 |
+
# Download example images from the Space repo at startup
|
| 16 |
+
EXAMPLE_PAIRS = [
|
| 17 |
+
("examples/fox_drinking_og.png", "examples/fox_drinking__edit__01.png"),
|
| 18 |
+
("examples/palm_tree_og.png", "examples/palm_tree__edit__01.png"),
|
| 19 |
+
("examples/kingfisher_og.png", "examples/kingfisher__edit__001.png"),
|
| 20 |
+
("examples/pipes_og.png", "examples/pipes__edit__01.png"),
|
| 21 |
+
("examples/dog_beach_og.png", "examples/dog_beach__edit__003.png"),
|
| 22 |
+
]
|
| 23 |
+
examples = [
|
| 24 |
+
[
|
| 25 |
+
hf_hub_download(repo_id="HadiZayer/MagicFixup", filename=og, repo_type="space"),
|
| 26 |
+
hf_hub_download(repo_id="HadiZayer/MagicFixup", filename=edit, repo_type="space"),
|
| 27 |
+
]
|
| 28 |
+
for og, edit in EXAMPLE_PAIRS
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
magic_fixup = MagicFixup(model_path=checkpoint_path)
|
| 32 |
|
| 33 |
|
|
|
|
| 56 |
gr.Image(type="pil", image_mode="RGBA", label="Coarse Edit (with alpha mask)"),
|
| 57 |
],
|
| 58 |
outputs=gr.Image(label="Result"),
|
| 59 |
+
examples=examples,
|
| 60 |
title="Magic Fixup",
|
| 61 |
description="Upload your original image and a coarse edit (PNG with alpha channel marking the edited region). Magic Fixup will refine the edit to look photorealistic.",
|
| 62 |
)
|