vluz commited on
Commit
b224257
1 Parent(s): 4326f00

Update README.md

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