nroggendorff commited on
Commit
979e897
1 Parent(s): 37d9c3a

add name checker too also

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -97,9 +97,11 @@ def download_from_url(url, name=None):
97
  url = url.replace("/blob/", "/resolve/")
98
  if "huggingface" not in url:
99
  return ["The URL must be from huggingface", "Failed", "Failed"]
100
- filename = os.path.join(TEMP_DIR, MODEL_PREFIX + str(random.randint(1, 1000)) + ".zip")
101
  if contains_bad_word(url, bad_words):
102
- return BadWordError("The filename has a bad word.")
 
 
 
103
  response = requests.get(url)
104
  total = int(response.headers.get('content-length', 0))
105
  if total > 500000000:
 
97
  url = url.replace("/blob/", "/resolve/")
98
  if "huggingface" not in url:
99
  return ["The URL must be from huggingface", "Failed", "Failed"]
 
100
  if contains_bad_word(url, bad_words):
101
+ return BadWordError("The file url has a bad word.")
102
+ if contains_bad_word(name, bad_words):
103
+ return BadWordError("The file name has a bad word.")
104
+ filename = os.path.join(TEMP_DIR, MODEL_PREFIX + str(random.randint(1, 1000)) + ".zip")
105
  response = requests.get(url)
106
  total = int(response.headers.get('content-length', 0))
107
  if total > 500000000: