sivdead commited on
Commit
2ea7269
1 Parent(s): fe99da6

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,5 +1,5 @@
1
- import logging
2
  import os
 
3
  from typing import List, Optional
4
 
5
  import gradio as gr
@@ -73,7 +73,8 @@ def push_to_wiseModel(
73
  repo_dir = f"./{cache_dir}/{repo_name}"
74
  os.makedirs(repo_dir, exist_ok=True)
75
  source_dir = f"./{cache_dir}/hf/{hf_repo_id}"
76
- move_file(source_dir, repo_dir, excludes=[".gitattributes"])
 
77
  gitCmd.add(repo_dir, all_files=True)
78
  gitCmd.commit(repo_dir, message="commit from hf to wisemodel")
79
  gitCmd.push(repo_dir, token, url, branch, branch)
@@ -93,14 +94,14 @@ def move_file(source: str, destination: str, excludes: list[str] = []):
93
  continue
94
  # if file already exists in the destination directory, remove it
95
  if os.path.exists(f"{destination}/{file}"):
96
- logging.info(f"Removing {file} from {destination}")
97
  # incase is a directory, remove it recursively
98
  if os.path.isdir(f"{destination}/{file}"):
99
  # force remove the directory and all its contents
100
  shutil.rmtree(f"{destination}/{file}", ignore_errors=True)
101
  else:
102
  os.remove(f"{destination}/{file}")
103
- logging.info(f"Moving {file} to {destination}")
104
  # move each file to destination Directory, if it already exists, it will be replaced
105
  shutil.move(f"{source}/{file}", destination)
106
  except Exception as e:
 
 
1
  import os
2
+ import logging
3
  from typing import List, Optional
4
 
5
  import gradio as gr
 
73
  repo_dir = f"./{cache_dir}/{repo_name}"
74
  os.makedirs(repo_dir, exist_ok=True)
75
  source_dir = f"./{cache_dir}/hf/{hf_repo_id}"
76
+ move_file(source_dir, repo_dir)
77
+ # move_file(source_dir, repo_dir, excludes=[".gitattributes", ".git"])
78
  gitCmd.add(repo_dir, all_files=True)
79
  gitCmd.commit(repo_dir, message="commit from hf to wisemodel")
80
  gitCmd.push(repo_dir, token, url, branch, branch)
 
94
  continue
95
  # if file already exists in the destination directory, remove it
96
  if os.path.exists(f"{destination}/{file}"):
97
+ print(f"Removing {file} from {destination}")
98
  # incase is a directory, remove it recursively
99
  if os.path.isdir(f"{destination}/{file}"):
100
  # force remove the directory and all its contents
101
  shutil.rmtree(f"{destination}/{file}", ignore_errors=True)
102
  else:
103
  os.remove(f"{destination}/{file}")
104
+ print(f"Moving {file} to {destination}")
105
  # move each file to destination Directory, if it already exists, it will be replaced
106
  shutil.move(f"{source}/{file}", destination)
107
  except Exception as e: