Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def preprocess_text(text: str) -> str:
|
|
| 25 |
tokens = [word for word in tokens if word not in stop_words]
|
| 26 |
return " ".join(tokens)
|
| 27 |
|
| 28 |
-
# === Load
|
| 29 |
print("Loading SentenceTransformer...")
|
| 30 |
st_model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2")
|
| 31 |
|
|
@@ -50,7 +50,7 @@ def predict(input_data: EssayInput):
|
|
| 50 |
essay_length = len(input_data.text)
|
| 51 |
X = np.concatenate([vec, [[essay_length]]], axis=1)
|
| 52 |
|
| 53 |
-
# 4. Predict
|
| 54 |
results = {}
|
| 55 |
for col, model in models.items():
|
| 56 |
results[col] = float(model.predict(X)[0])
|
|
|
|
| 25 |
tokens = [word for word in tokens if word not in stop_words]
|
| 26 |
return " ".join(tokens)
|
| 27 |
|
| 28 |
+
# === Load Models ===
|
| 29 |
print("Loading SentenceTransformer...")
|
| 30 |
st_model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2")
|
| 31 |
|
|
|
|
| 50 |
essay_length = len(input_data.text)
|
| 51 |
X = np.concatenate([vec, [[essay_length]]], axis=1)
|
| 52 |
|
| 53 |
+
# 4. Predict dengan setiap model
|
| 54 |
results = {}
|
| 55 |
for col, model in models.items():
|
| 56 |
results[col] = float(model.predict(X)[0])
|