Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files- .gitignore +2 -0
- app.py +16 -11
- uv.lock +3 -3
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Ignore local
|
2 |
+
local/
|
app.py
CHANGED
@@ -27,10 +27,11 @@ MASK_CONTEXT_PADDING = 16 * 8
|
|
27 |
|
28 |
api = HfApi()
|
29 |
|
|
|
|
|
30 |
# Download the blanchon/FurnitureFlags init Path(__file__).parent / examples_dataset
|
31 |
FLAG_PATH = Path(__file__).parent / "examples_dataset"
|
32 |
if not torch.cuda.is_available():
|
33 |
-
FLAG_PATH = Path(__file__).parent / "examples_dataset"
|
34 |
FLAG_PATH.mkdir(parents=True, exist_ok=True)
|
35 |
else:
|
36 |
api.snapshot_download(
|
@@ -47,7 +48,7 @@ for flag_file in flag_files:
|
|
47 |
reader = csv.reader(file)
|
48 |
next(reader)
|
49 |
for row in reader:
|
50 |
-
furniture_image, room_image, results_values, time = row
|
51 |
room_image = json.loads(room_image)
|
52 |
room_image_background = room_image["background"]
|
53 |
room_image_layers = room_image["layers"]
|
@@ -75,7 +76,7 @@ if not torch.cuda.is_available():
|
|
75 |
else:
|
76 |
state_dict, network_alphas = FluxFillPipeline.lora_state_dict(
|
77 |
pretrained_model_name_or_path_or_dict="blanchon/FluxFillFurniture",
|
78 |
-
weight_name=
|
79 |
return_alphas=True,
|
80 |
)
|
81 |
|
@@ -226,14 +227,16 @@ def flag(
|
|
226 |
return
|
227 |
callback.flag(
|
228 |
flag_data=[furniture_image_input, room_image_input, results],
|
|
|
229 |
)
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
237 |
|
238 |
|
239 |
@spaces.GPU(duration=150)
|
@@ -446,6 +449,7 @@ with gr.Blocks(css=css) as demo:
|
|
446 |
)
|
447 |
furniture_examples = gr.Examples(
|
448 |
examples=list({example[0] for example in EXAMPLES.values()}),
|
|
|
449 |
examples_per_page=6,
|
450 |
inputs=[furniture_image_input],
|
451 |
)
|
@@ -471,6 +475,7 @@ with gr.Blocks(css=css) as demo:
|
|
471 |
)
|
472 |
room_examples = gr.Examples(
|
473 |
examples=[example[1] for example in EXAMPLES.values()],
|
|
|
474 |
examples_per_page=6,
|
475 |
# examples=[
|
476 |
# make_example(
|
@@ -583,7 +588,7 @@ with gr.Blocks(css=css) as demo:
|
|
583 |
show_case = gr.Examples(
|
584 |
examples=list(EXAMPLES.values()),
|
585 |
inputs=[furniture_image_input, room_image_input, results],
|
586 |
-
label=
|
587 |
examples_per_page=12,
|
588 |
)
|
589 |
|
|
|
27 |
|
28 |
api = HfApi()
|
29 |
|
30 |
+
model_name = "2025-01-11_22-00-18-save-10359-55-129_patched.safetensors"
|
31 |
+
|
32 |
# Download the blanchon/FurnitureFlags init Path(__file__).parent / examples_dataset
|
33 |
FLAG_PATH = Path(__file__).parent / "examples_dataset"
|
34 |
if not torch.cuda.is_available():
|
|
|
35 |
FLAG_PATH.mkdir(parents=True, exist_ok=True)
|
36 |
else:
|
37 |
api.snapshot_download(
|
|
|
48 |
reader = csv.reader(file)
|
49 |
next(reader)
|
50 |
for row in reader:
|
51 |
+
furniture_image, room_image, results_values, time, *others = row
|
52 |
room_image = json.loads(room_image)
|
53 |
room_image_background = room_image["background"]
|
54 |
room_image_layers = room_image["layers"]
|
|
|
76 |
else:
|
77 |
state_dict, network_alphas = FluxFillPipeline.lora_state_dict(
|
78 |
pretrained_model_name_or_path_or_dict="blanchon/FluxFillFurniture",
|
79 |
+
weight_name=model_name,
|
80 |
return_alphas=True,
|
81 |
)
|
82 |
|
|
|
227 |
return
|
228 |
callback.flag(
|
229 |
flag_data=[furniture_image_input, room_image_input, results],
|
230 |
+
flag_option=model_name,
|
231 |
)
|
232 |
+
if torch.cuda.is_available():
|
233 |
+
# Upload the flagged data points to the hub
|
234 |
+
api.upload_folder(
|
235 |
+
repo_id="blanchon/FurnitureFlags",
|
236 |
+
repo_type="dataset",
|
237 |
+
folder_path=FLAG_PATH,
|
238 |
+
ignore_patterns=[".cache"],
|
239 |
+
)
|
240 |
|
241 |
|
242 |
@spaces.GPU(duration=150)
|
|
|
449 |
)
|
450 |
furniture_examples = gr.Examples(
|
451 |
examples=list({example[0] for example in EXAMPLES.values()}),
|
452 |
+
label="Furniture examples",
|
453 |
examples_per_page=6,
|
454 |
inputs=[furniture_image_input],
|
455 |
)
|
|
|
475 |
)
|
476 |
room_examples = gr.Examples(
|
477 |
examples=[example[1] for example in EXAMPLES.values()],
|
478 |
+
label="Room examples",
|
479 |
examples_per_page=6,
|
480 |
# examples=[
|
481 |
# make_example(
|
|
|
588 |
show_case = gr.Examples(
|
589 |
examples=list(EXAMPLES.values()),
|
590 |
inputs=[furniture_image_input, room_image_input, results],
|
591 |
+
label="Examples",
|
592 |
examples_per_page=12,
|
593 |
)
|
594 |
|
uv.lock
CHANGED
@@ -240,11 +240,11 @@ requires-dist = [
|
|
240 |
|
241 |
[[package]]
|
242 |
name = "fsspec"
|
243 |
-
version = "2024.
|
244 |
source = { registry = "https://pypi.org/simple" }
|
245 |
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
246 |
wheels = [
|
247 |
-
{ url = "https://files.pythonhosted.org/packages/
|
248 |
]
|
249 |
|
250 |
[[package]]
|
|
|
240 |
|
241 |
[[package]]
|
242 |
name = "fsspec"
|
243 |
+
version = "2024.9.0"
|
244 |
source = { registry = "https://pypi.org/simple" }
|
245 |
+
sdist = { url = "https://files.pythonhosted.org/packages/62/7c/12b0943011daaaa9c35c2a2e22e5eb929ac90002f08f1259d69aedad84de/fsspec-2024.9.0.tar.gz", hash = "sha256:4b0afb90c2f21832df142f292649035d80b421f60a9e1c027802e5a0da2b04e8", size = 286206 }
|
246 |
wheels = [
|
247 |
+
{ url = "https://files.pythonhosted.org/packages/1d/a0/6aaea0c2fbea2f89bfd5db25fb1e3481896a423002ebe4e55288907a97a3/fsspec-2024.9.0-py3-none-any.whl", hash = "sha256:a0947d552d8a6efa72cc2c730b12c41d043509156966cca4fb157b0f2a0c574b", size = 179253 },
|
248 |
]
|
249 |
|
250 |
[[package]]
|