Mahmudm commited on
Commit
fe27eb6
·
verified ·
1 Parent(s): 4f19bc4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -71,20 +71,12 @@ def process_zip(event=None):
71
  status.object = "✅ ZIP uploaded and saved."
72
  else:
73
  zip_path = os.path.join(MEDIA_DIR, "default_model.zip")
74
- if not os.path.exists(zip_path):
75
- zip_path = "default_model.zip" # fallback to local directory
76
  if not os.path.exists(zip_path):
77
  status.object = "❌ No ZIP uploaded and default_model.zip not found."
78
  return
79
  status.object = "📦 Using default_model.zip"
80
 
81
-
82
- try:
83
- output_dir = os.path.join("./", "ash_output")
84
- os.makedirs(output_dir, exist_ok=True)
85
- except PermissionError:
86
- output_dir = os.path.join(tempfile.gettempdir(), "name_output")
87
- os.makedirs(output_dir, exist_ok=True)
88
  shutil.rmtree(output_dir, ignore_errors=True)
89
  os.makedirs(output_dir, exist_ok=True)
90
 
@@ -95,10 +87,6 @@ def process_zip(event=None):
95
  # animator_obj["3d"] = [xr.open_dataset(fp).load()
96
  # for fp in sorted(glob.glob(os.path.join(output_dir, "3D", "*.nc")))]
97
 
98
- # animator_obj["3d"] = []
99
- # for fp in sorted(glob.glob(os.path.join(output_dir, "3D", "*.nc"))):
100
- # with xr.open_dataset(fp) as ds:
101
- # animator_obj["3d"].append(ds.load())
102
  animator_obj["3d"] = []
103
  for fp in sorted(glob.glob(os.path.join(output_dir, "3D", "*.nc"))):
104
  with xr.open_dataset(fp) as ds:
 
71
  status.object = "✅ ZIP uploaded and saved."
72
  else:
73
  zip_path = os.path.join(MEDIA_DIR, "default_model.zip")
 
 
74
  if not os.path.exists(zip_path):
75
  status.object = "❌ No ZIP uploaded and default_model.zip not found."
76
  return
77
  status.object = "📦 Using default_model.zip"
78
 
79
+ output_dir = os.path.join("./", "ash_output")
 
 
 
 
 
 
80
  shutil.rmtree(output_dir, ignore_errors=True)
81
  os.makedirs(output_dir, exist_ok=True)
82
 
 
87
  # animator_obj["3d"] = [xr.open_dataset(fp).load()
88
  # for fp in sorted(glob.glob(os.path.join(output_dir, "3D", "*.nc")))]
89
 
 
 
 
 
90
  animator_obj["3d"] = []
91
  for fp in sorted(glob.glob(os.path.join(output_dir, "3D", "*.nc"))):
92
  with xr.open_dataset(fp) as ds: