Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
mariotawfik
commited on
Commit
•
dd436d9
1
Parent(s):
16607b8
commit
Browse files
app.py
CHANGED
@@ -94,29 +94,8 @@ def keygen(eval_key):
|
|
94 |
user_id = eval_key[1]
|
95 |
return eval_key[0]
|
96 |
|
97 |
-
def safe_eval(encodings):
|
98 |
-
try:
|
99 |
-
# Debugging: Print the encodings string to understand its format
|
100 |
-
print("Original Encodings String:", encodings)
|
101 |
-
|
102 |
-
# Replace newline characters and multiple spaces
|
103 |
-
sanitized = encodings.replace('\n', ',').replace(' ', '')
|
104 |
-
sanitized = sanitized.replace(',,', ',') # Remove accidental double commas
|
105 |
-
|
106 |
-
# Ensure the string starts and ends properly for evaluation
|
107 |
-
if not sanitized.startswith("["):
|
108 |
-
sanitized = "[" + sanitized
|
109 |
-
if not sanitized.endswith("]"):
|
110 |
-
sanitized = sanitized + "]"
|
111 |
-
|
112 |
-
print("Sanitized Encodings String:", sanitized)
|
113 |
-
|
114 |
-
return eval(sanitized)
|
115 |
-
except SyntaxError as e:
|
116 |
-
raise ValueError(f"Failed to safely parse the encodings string: {e}")
|
117 |
-
|
118 |
|
119 |
-
def encode_quantize(test_file
|
120 |
ugly = ['Machine', 'SizeOfOptionalHeader', 'Characteristics',
|
121 |
'MajorLinkerVersion', 'MinorLinkerVersion', 'SizeOfCode',
|
122 |
'SizeOfInitializedData', 'SizeOfUninitializedData',
|
@@ -384,7 +363,7 @@ if __name__ == "__main__":
|
|
384 |
# Button to extract vector
|
385 |
b_extract.click(
|
386 |
fn=encode_quantize,
|
387 |
-
inputs=[file_input
|
388 |
outputs=[extracted_vector],
|
389 |
)
|
390 |
|
|
|
94 |
user_id = eval_key[1]
|
95 |
return eval_key[0]
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
def encode_quantize(test_file):
|
99 |
ugly = ['Machine', 'SizeOfOptionalHeader', 'Characteristics',
|
100 |
'MajorLinkerVersion', 'MinorLinkerVersion', 'SizeOfCode',
|
101 |
'SizeOfInitializedData', 'SizeOfUninitializedData',
|
|
|
363 |
# Button to extract vector
|
364 |
b_extract.click(
|
365 |
fn=encode_quantize,
|
366 |
+
inputs=[file_input],
|
367 |
outputs=[extracted_vector],
|
368 |
)
|
369 |
|