gourav3017 commited on
Commit
aa965c4
·
1 Parent(s): bddf009

Update app.py for new hub version and download to local

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -7,6 +7,7 @@ from huggingface_hub import hf_hub_download
7
  from huggingface_hub import list_repo_files
8
  import io
9
  import zipfile
 
10
 
11
  # Replace this with your actual Hugging Face repo ID
12
  REPO_ID = "PortPy-Project/PortPy_Dataset"
@@ -327,6 +328,8 @@ def main():
327
  status = st.empty()
328
 
329
  local_dir = "./downloaded"
 
 
330
  os.makedirs(local_dir, exist_ok=True)
331
 
332
  patient_to_beams = {
@@ -351,7 +354,7 @@ def main():
351
 
352
  # Create zip in memory
353
  buf = io.BytesIO()
354
- with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as zf:
355
  for root, _, files in os.walk(local_dir):
356
  for f in files:
357
  full_path = os.path.join(root, f)
 
7
  from huggingface_hub import list_repo_files
8
  import io
9
  import zipfile
10
+ import shutil
11
 
12
  # Replace this with your actual Hugging Face repo ID
13
  REPO_ID = "PortPy-Project/PortPy_Dataset"
 
328
  status = st.empty()
329
 
330
  local_dir = "./downloaded"
331
+ if os.path.exists(local_dir):
332
+ shutil.rmtree(local_dir)
333
  os.makedirs(local_dir, exist_ok=True)
334
 
335
  patient_to_beams = {
 
354
 
355
  # Create zip in memory
356
  buf = io.BytesIO()
357
+ with zipfile.ZipFile(buf, "w", zipfile.ZIP_STORED) as zf:
358
  for root, _, files in os.walk(local_dir):
359
  for f in files:
360
  full_path = os.path.join(root, f)