Spaces:
Running on Zero
Running on Zero
Commit ·
0f0585b
1
Parent(s): 81e8cdf
upgraded autoforge to 1.9.2.3 and fixed flatforge output
Browse files- app.py +19 -11
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -674,7 +674,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 674 |
label="Console Output",
|
| 675 |
lines=15,
|
| 676 |
autoscroll=True,
|
| 677 |
-
show_copy_button=False,
|
| 678 |
)
|
| 679 |
|
| 680 |
with gr.Row():
|
|
@@ -870,16 +870,22 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 870 |
|
| 871 |
return_code = worker.returncode
|
| 872 |
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
os.path.join(run_output_dir_val, "swap_instructions.txt"),
|
| 879 |
-
os.path.join(run_output_dir_val, "project_file.hfp"),
|
| 880 |
-
]
|
| 881 |
-
if os.path.exists(p)
|
| 882 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 883 |
png_path = os.path.join(run_output_dir_val, "final_model.png")
|
| 884 |
out_png = png_path if os.path.exists(png_path) else None
|
| 885 |
|
|
@@ -906,7 +912,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 906 |
try:
|
| 907 |
with zipfile.ZipFile(zip_path, "w", compression=zipfile.ZIP_STORED) as zf:
|
| 908 |
for f in files_to_offer:
|
| 909 |
-
|
|
|
|
|
|
|
| 910 |
log_output.append(" done.")
|
| 911 |
except Exception as e:
|
| 912 |
log_output.append(f"\nError creating zip file: {e}")
|
|
|
|
| 674 |
label="Console Output",
|
| 675 |
lines=15,
|
| 676 |
autoscroll=True,
|
| 677 |
+
#show_copy_button=False,
|
| 678 |
)
|
| 679 |
|
| 680 |
with gr.Row():
|
|
|
|
| 870 |
|
| 871 |
return_code = worker.returncode
|
| 872 |
|
| 873 |
+
# Gather outputs, including all STL files (FlatForge may create multiple)
|
| 874 |
+
static_files = [
|
| 875 |
+
os.path.join(run_output_dir_val, "final_model.png"),
|
| 876 |
+
os.path.join(run_output_dir_val, "swap_instructions.txt"),
|
| 877 |
+
os.path.join(run_output_dir_val, "project_file.hfp"),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 878 |
]
|
| 879 |
+
stl_files = []
|
| 880 |
+
for root, _, files in os.walk(run_output_dir_val):
|
| 881 |
+
for fname in files:
|
| 882 |
+
if fname.lower().endswith(".stl"):
|
| 883 |
+
stl_files.append(os.path.join(root, fname))
|
| 884 |
+
|
| 885 |
+
files_to_offer = [p for p in static_files if os.path.exists(p)] + stl_files
|
| 886 |
+
# Deduplicate while preserving order
|
| 887 |
+
seen = set()
|
| 888 |
+
files_to_offer = [f for f in files_to_offer if not (f in seen or seen.add(f))]
|
| 889 |
png_path = os.path.join(run_output_dir_val, "final_model.png")
|
| 890 |
out_png = png_path if os.path.exists(png_path) else None
|
| 891 |
|
|
|
|
| 912 |
try:
|
| 913 |
with zipfile.ZipFile(zip_path, "w", compression=zipfile.ZIP_STORED) as zf:
|
| 914 |
for f in files_to_offer:
|
| 915 |
+
# Preserve relative paths to avoid collisions when multiple STLs exist
|
| 916 |
+
arcname = os.path.relpath(f, run_output_dir_val)
|
| 917 |
+
zf.write(f, arcname)
|
| 918 |
log_output.append(" done.")
|
| 919 |
except Exception as e:
|
| 920 |
log_output.append(f"\nError creating zip file: {e}")
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
autoforge==1.9.2.
|
| 2 |
sentry-sdk[huggingface_hub]
|
| 3 |
sentry-sdk[fastapi]
|
| 4 |
wandb
|
|
|
|
| 1 |
+
autoforge==1.9.2.3
|
| 2 |
sentry-sdk[huggingface_hub]
|
| 3 |
sentry-sdk[fastapi]
|
| 4 |
wandb
|