Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
4ed0876
1
Parent(s):
37d9c3a
add name checker too also (#50)
Browse files- add name checker too also (979e8970fc095ff00b405f672e7c8e4f12026d40)
Co-authored-by: Noa Roggendorff <nroggendorff@users.noreply.huggingface.co>
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
|
|
|
|
|
|
|
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:
|