Update README.md
Browse files
README.md
CHANGED
@@ -43,7 +43,7 @@ def load_model():
|
|
43 |
def load_vectorizer():
|
44 |
from_disk = pickle.load(open(os.path.join("model", "vectorizer.pkl"), "rb"))
|
45 |
new_v = TextVectorization.from_config(from_disk['config'])
|
46 |
-
new_v.adapt(tf.data.Dataset.from_tensor_slices(["xyz"])) # Keras bug
|
47 |
new_v.set_weights(from_disk['weights'])
|
48 |
return new_v
|
49 |
|
@@ -52,8 +52,15 @@ st.title("Toxic Comment Test")
|
|
52 |
st.divider()
|
53 |
model = load_model()
|
54 |
vectorizer = load_vectorizer()
|
55 |
-
|
|
|
56 |
if st.button("Test"):
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
with st.spinner("Testing..."):
|
58 |
inputv = vectorizer([input_text])
|
59 |
output = model.predict(inputv)
|
|
|
43 |
def load_vectorizer():
|
44 |
from_disk = pickle.load(open(os.path.join("model", "vectorizer.pkl"), "rb"))
|
45 |
new_v = TextVectorization.from_config(from_disk['config'])
|
46 |
+
new_v.adapt(tf.data.Dataset.from_tensor_slices(["xyz"])) # fix for Keras bug
|
47 |
new_v.set_weights(from_disk['weights'])
|
48 |
return new_v
|
49 |
|
|
|
52 |
st.divider()
|
53 |
model = load_model()
|
54 |
vectorizer = load_vectorizer()
|
55 |
+
default_prompt = "i love you man, but fuck you!"
|
56 |
+
input_text = st.text_area("Comment:", default_prompt, height=150).lower()
|
57 |
if st.button("Test"):
|
58 |
+
if not input_text:
|
59 |
+
st.write("⚠ Warning: Empty prompt.")
|
60 |
+
elif len(input_text) < 15:
|
61 |
+
st.write("⚠ Warning: Model is far less accurate with a small prompt.")
|
62 |
+
if input_text == default_prompt:
|
63 |
+
st.write("Expected results from default prompt are positive for 0 and 2")
|
64 |
with st.spinner("Testing..."):
|
65 |
inputv = vectorizer([input_text])
|
66 |
output = model.predict(inputv)
|