-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
52 lines (41 loc) · 2.51 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Import required libraries
import streamlit as st
from model import calculate_perplexity, calculate_burstiness, plot_top_repeated_words
# Set page configuration and title for Streamlit
st.set_page_config(page_title="PlagSnipe", page_icon="📑", layout="wide")
# Add header with title and description
st.markdown(
'<p style="display:inline-block;font-size:40px;font-weight:bold;">📖PlagSnipe</p> <p style="display:inline-block;font-size:16px;">PlagSnipe is an AI-powered plagiarism detection tool that leverages GPT-2 and NLTK to determine if a given text is AI-generated. By analyzing perplexity and burstiness, PlagSnipe provides accurate insights into the authorship of the text, distinguishing between human-written and AI-generated content.<br><br></p>',
unsafe_allow_html=True
)
text_area = st.text_area("Enter text", "")
if text_area is not None:
if st.button("Analyze"):
col1, col2, col3 = st.columns([1, 1, 1])
with col1:
st.info("Your Input Text")
st.success(text_area)
with col2:
st.info("Detection Score")
perplexity = calculate_perplexity(text_area)
burstiness_score = calculate_burstiness(text_area)
st.write("Perplexity:", perplexity)
st.write("Burstiness Score:", burstiness_score)
if perplexity > 30000 and burstiness_score < 0.2:
st.error("🤖Text Analysis Result: AI generated content")
else:
st.success("🤖Text Analysis Result: Likely not generated by AI")
st.warning("Disclaimer: AI plagiarism detector apps can assist in identifying potential instances of plagiarism; however, it is important to note that their results may not be entirely flawless or completely reliable. These tools employ advanced algorithms, but they can still produce false positives or false negatives. Therefore, it is recommended to use AI plagiarism detectors as a supplementary tool alongside human judgment and manual verification for accurate and comprehensive plagiarism detection.")
with col3:
st.info("Basic Details")
plot_top_repeated_words(text_area)
# Hide Streamlit header, footer, and menu
hide_st_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
</style>
"""
# Apply CSS code to hide header, footer, and menu
st.markdown(hide_st_style, unsafe_allow_html=True)