chgrdj's picture
Update app.py
afe3cda verified
raw
history blame
966 Bytes
import streamlit as st
from sentence_transformers import CrossEncoder
model_name = "./"
model = CrossEncoder(model_name)
st.title("Typosquatting Detection App")
st.write("Enter two domains to check if one is a typosquatted variant of the other.")
domain = st.text_input("Enter the legitimate domain name:")
typosquat = st.text_input("Enter the potentially typosquatted domain name:")
st.write("Recommended threshold for detection is 0.3.")
threshold = st.slider("Set detection threshold", 0.0, 1.0, 0.3)
if st.button("Check Typosquatting"):
inputs = [(typosquat,domain)]
prediction = model.predict(inputs)[0]
print(prediction)
if prediction > threshold:
st.success(f"The model predicts that '{typosquat}' is likely a typosquatted version of '{domain}' with a score of {prediction}.")
else:
st.warning(f"The model predicts that '{typosquat}' is NOT likely a typosquatted version of '{domain}' with a score of {prediction}.")