Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from sentence_transformers import CrossEncoder
|
| 3 |
+
|
| 4 |
+
model_name = "Anvilogic/CE-typosquat-detect"
|
| 5 |
+
model = CrossEncoder(model_name)
|
| 6 |
+
|
| 7 |
+
st.title("Typosquatting Detection App")
|
| 8 |
+
st.write("Enter two domains to check if one is a typosquatted variant of the other.")
|
| 9 |
+
|
| 10 |
+
domain = st.text_input("Enter the legitimate domain name:")
|
| 11 |
+
sim_domain = st.text_input("Enter the potentially typosquatted domain name:")
|
| 12 |
+
|
| 13 |
+
if st.button("Check Typosquatting"):
|
| 14 |
+
inputs = [(domain, sim_domain)]
|
| 15 |
+
prediction = model.predict(inputs)[0]
|
| 16 |
+
|
| 17 |
+
if prediction > 0.5:
|
| 18 |
+
st.success(f"The model predicts that '{sim_domain}' is likely a typosquatted version of '{domain}'.")
|
| 19 |
+
else:
|
| 20 |
+
st.warning(f"The model predicts that '{sim_domain}' is NOT likely a typosquatted version of '{domain}'.")
|