Spaces:
Sleeping
Sleeping
update
Browse files
main.py
CHANGED
@@ -10,8 +10,7 @@ from pathlib import Path
|
|
10 |
import platform
|
11 |
import time
|
12 |
import tempfile
|
13 |
-
|
14 |
-
import shortuuid
|
15 |
|
16 |
from project_settings import project_path, log_directory
|
17 |
import log
|
@@ -64,6 +63,15 @@ def build_html_output(s: str, style: str = "result_item_success"):
|
|
64 |
"""
|
65 |
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
@torch.no_grad()
|
68 |
def process(
|
69 |
language: str,
|
@@ -106,16 +114,14 @@ def process(
|
|
106 |
if len(repo_id.parts) == 1:
|
107 |
repo_name = repo_id.parts[-1]
|
108 |
if len(repo_name) > 40:
|
109 |
-
|
110 |
-
repo_name = str(shortuuid.uuid())
|
111 |
# repo_name = repo_name[:40]
|
112 |
folder = repo_name
|
113 |
elif len(repo_id.parts) == 2:
|
114 |
repo_supplier = repo_id.parts[-2]
|
115 |
repo_name = repo_id.parts[-1]
|
116 |
if len(repo_name) > 40:
|
117 |
-
|
118 |
-
repo_name = str(shortuuid.uuid())
|
119 |
# repo_name = repo_name[:40]
|
120 |
folder = "{}/{}".format(repo_supplier, repo_name)
|
121 |
else:
|
|
|
10 |
import platform
|
11 |
import time
|
12 |
import tempfile
|
13 |
+
import hashlib
|
|
|
14 |
|
15 |
from project_settings import project_path, log_directory
|
16 |
import log
|
|
|
63 |
"""
|
64 |
|
65 |
|
66 |
+
def md5_encrypt(text: str) -> str:
|
67 |
+
md = hashlib.md5()
|
68 |
+
|
69 |
+
md.update(text.encode())
|
70 |
+
|
71 |
+
result = md.hexdigest()
|
72 |
+
return result
|
73 |
+
|
74 |
+
|
75 |
@torch.no_grad()
|
76 |
def process(
|
77 |
language: str,
|
|
|
114 |
if len(repo_id.parts) == 1:
|
115 |
repo_name = repo_id.parts[-1]
|
116 |
if len(repo_name) > 40:
|
117 |
+
repo_name = md5_encrypt(repo_name)
|
|
|
118 |
# repo_name = repo_name[:40]
|
119 |
folder = repo_name
|
120 |
elif len(repo_id.parts) == 2:
|
121 |
repo_supplier = repo_id.parts[-2]
|
122 |
repo_name = repo_id.parts[-1]
|
123 |
if len(repo_name) > 40:
|
124 |
+
repo_name = md5_encrypt(repo_name)
|
|
|
125 |
# repo_name = repo_name[:40]
|
126 |
folder = "{}/{}".format(repo_supplier, repo_name)
|
127 |
else:
|