Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ with open("xgboost_best_model.pkl", "wb") as f:
|
|
14 |
f.write(response.content)
|
15 |
xgb_model = joblib.load("xgboost_best_model.pkl")
|
16 |
|
17 |
-
# Streamlit UI
|
18 |
st.title("Paraphrase Detection with SentenceTransformer and XGBoost for Indonesian Sentences")
|
19 |
st.write(
|
20 |
"""
|
@@ -43,11 +42,9 @@ if st.button("Check Paraphrase"):
|
|
43 |
embedding1 = model.encode(sentence1)
|
44 |
embedding2 = model.encode(sentence2)
|
45 |
|
46 |
-
# Hitung cosine similarity
|
47 |
similarity = cosine_similarity([embedding1], [embedding2])[0][0]
|
48 |
st.write(f"Cosine Similarity: {similarity:.4f}")
|
49 |
|
50 |
-
# Gunakan model XGBoost untuk memprediksi apakah ini parafrasa atau tidak
|
51 |
prediction = xgb_model.predict(np.array([[similarity]]))
|
52 |
if prediction == 1:
|
53 |
st.success("The sentences are likely paraphrases of each other.")
|
|
|
14 |
f.write(response.content)
|
15 |
xgb_model = joblib.load("xgboost_best_model.pkl")
|
16 |
|
|
|
17 |
st.title("Paraphrase Detection with SentenceTransformer and XGBoost for Indonesian Sentences")
|
18 |
st.write(
|
19 |
"""
|
|
|
42 |
embedding1 = model.encode(sentence1)
|
43 |
embedding2 = model.encode(sentence2)
|
44 |
|
|
|
45 |
similarity = cosine_similarity([embedding1], [embedding2])[0][0]
|
46 |
st.write(f"Cosine Similarity: {similarity:.4f}")
|
47 |
|
|
|
48 |
prediction = xgb_model.predict(np.array([[similarity]]))
|
49 |
if prediction == 1:
|
50 |
st.success("The sentences are likely paraphrases of each other.")
|