sundaram07 commited on
Commit
c0a3abb
Β·
verified Β·
1 Parent(s): fae0850

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +3 -3
src/streamlit_app.py CHANGED
@@ -27,7 +27,7 @@ def predict_sentence_ai_probability(sentence):
27
  return prob_ai
28
 
29
  # πŸ“Š Analyze all sentences
30
- def predict_ai_generated_percentage(text, threshold=0.75):
31
  text = text.strip()
32
  sentences = sent_tokenize(text)
33
  ai_sentence_count = 0
@@ -35,7 +35,7 @@ def predict_ai_generated_percentage(text, threshold=0.75):
35
 
36
  for sentence in sentences:
37
  prob = predict_sentence_ai_probability(sentence)
38
- is_ai = prob >= threshold
39
  results.append((sentence, prob, is_ai))
40
  if is_ai:
41
  ai_sentence_count += 1
@@ -60,7 +60,7 @@ if st.button("πŸ” Analyze"):
60
  st.subheader("πŸ” Sentence-level Analysis")
61
  for i, (sentence, prob, is_ai) in enumerate(analysis_results, start=1):
62
  label = "🟒 Human" if not is_ai else "πŸ”΄ AI"
63
- st.markdown(f"**{i}.** _{sentence}_\n\n→ **Probability AI:** `{prob:.2%}` → {label}")
64
 
65
  st.subheader("πŸ“Š Final Result")
66
  st.success(f"Estimated **AI-generated content**: **{ai_percentage:.2f}%**")
 
27
  return prob_ai
28
 
29
  # πŸ“Š Analyze all sentences
30
+ def predict_ai_generated_percentage(text, threshold=0.15):
31
  text = text.strip()
32
  sentences = sent_tokenize(text)
33
  ai_sentence_count = 0
 
35
 
36
  for sentence in sentences:
37
  prob = predict_sentence_ai_probability(sentence)
38
+ is_ai = prob <= threshold
39
  results.append((sentence, prob, is_ai))
40
  if is_ai:
41
  ai_sentence_count += 1
 
60
  st.subheader("πŸ” Sentence-level Analysis")
61
  for i, (sentence, prob, is_ai) in enumerate(analysis_results, start=1):
62
  label = "🟒 Human" if not is_ai else "πŸ”΄ AI"
63
+ st.markdown(f"**{i}.** _{sentence}_\n\n β†’ {label}")
64
 
65
  st.subheader("πŸ“Š Final Result")
66
  st.success(f"Estimated **AI-generated content**: **{ai_percentage:.2f}%**")