Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- 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.
|
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
|
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
|
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}%**")
|