Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,11 +108,11 @@ def encode_quantize_encrypt(text, user_id):
|
|
| 108 |
if "legal_rating" in model_names:
|
| 109 |
fhe_api = FHEModelClient(FHE_LEGAL_PATH, f".fhe_keys/{user_id}")
|
| 110 |
encodings =vectorizer.fit_transform([text]).toarray()
|
| 111 |
-
if
|
| 112 |
# 在后面填充零
|
| 113 |
padding = np.zeros((1, 1736 - dense_matrix.shape[1]))
|
| 114 |
-
|
| 115 |
-
elif
|
| 116 |
# 截取前1736列
|
| 117 |
encodings = dense_matrix[:, :1736]
|
| 118 |
else:
|
|
|
|
| 108 |
if "legal_rating" in model_names:
|
| 109 |
fhe_api = FHEModelClient(FHE_LEGAL_PATH, f".fhe_keys/{user_id}")
|
| 110 |
encodings =vectorizer.fit_transform([text]).toarray()
|
| 111 |
+
if encodings.shape[1] < 1736:
|
| 112 |
# 在后面填充零
|
| 113 |
padding = np.zeros((1, 1736 - dense_matrix.shape[1]))
|
| 114 |
+
encodings = np.hstack((dense_matrix, padding))
|
| 115 |
+
elif encodings.shape[1] > 1736:
|
| 116 |
# 截取前1736列
|
| 117 |
encodings = dense_matrix[:, :1736]
|
| 118 |
else:
|