Benjamin Bossan commited on
Commit
7b83cb3
1 Parent(s): 564d114

Restrict snapshot_download to specific types

Browse files
Files changed (1) hide show
  1. start.py +4 -1
start.py CHANGED
@@ -132,7 +132,10 @@ def create_hf_model_card() -> None:
132
  return
133
 
134
  try:
135
- path = snapshot_download(repo_id)
 
 
 
136
  except (HFValidationError, RepositoryNotFoundError):
137
  st.error(
138
  f"Repository '{repo_id}' could not be found on HF Hub, "
 
132
  return
133
 
134
  try:
135
+ allow_patterns = [
136
+ "*.md", ".txt", "*.png", "*.gif", "*.jpg", "*.jpeg", "*.bmp", "*.webp"
137
+ ]
138
+ path = snapshot_download(repo_id, allow_patterns=allow_patterns)
139
  except (HFValidationError, RepositoryNotFoundError):
140
  st.error(
141
  f"Repository '{repo_id}' could not be found on HF Hub, "