Spaces:
Sleeping
Sleeping
jaifar530
commited on
fix
Browse files
app.py
CHANGED
@@ -23,8 +23,30 @@ nltk.download('stopwords')
|
|
23 |
nltk.download('averaged_perceptron_tagger')
|
24 |
|
25 |
#version
|
26 |
-
st.markdown("v1.
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
#title
|
30 |
st.title("Smart Detection System of AI-Generated Text Models")
|
@@ -33,7 +55,7 @@ st.title("Smart Detection System of AI-Generated Text Models")
|
|
33 |
st.markdown("This is a POC for Smart Detection System of AI Generated Text Models project (:blue[MSc Data Analytics]), it is a pre-trained model that detect the probablities of using any of the known LLM (chatgpt3, chatgpt4, GoogleBard, HuggingfaceChat)")
|
34 |
|
35 |
#input text
|
36 |
-
input_paragraph = st.text_area("Input your text here")
|
37 |
words_counts = word_tokenize(input_paragraph)
|
38 |
final_words = len(words_counts)
|
39 |
st.write('Words counts: ', final_words)
|
@@ -208,12 +230,12 @@ def AI_vs_AI_RandomForest_88_Samples(df):
|
|
208 |
response = requests.get(url, headers=headers)
|
209 |
|
210 |
# Save the file
|
211 |
-
with open('AI_vs_AI_RandomForest_88_Samples.pkl', 'wb') as
|
212 |
-
|
213 |
|
214 |
# At this point, the pickle file should exist, either it was already there, or it has been downloaded and extracted.
|
215 |
-
with open('AI_vs_AI_RandomForest_88_Samples.pkl', 'rb') as
|
216 |
-
clf_loaded = pickle.load(
|
217 |
|
218 |
input_features = df['paragraph'].apply(extract_features_AI_vs_AI_RandomForest_88_Samples)
|
219 |
|
|
|
23 |
nltk.download('averaged_perceptron_tagger')
|
24 |
|
25 |
#version
|
26 |
+
st.markdown("v1.5")
|
27 |
+
|
28 |
+
|
29 |
+
# URL of the text file
|
30 |
+
url = 'https://jaifar.net/text.txt'
|
31 |
+
|
32 |
+
headers = {
|
33 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
34 |
+
}
|
35 |
+
|
36 |
+
response = requests.get(url, headers=headers)
|
37 |
+
|
38 |
+
# Check if the request was successful
|
39 |
+
if response.status_code == 200:
|
40 |
+
# Read the content of the file
|
41 |
+
content = response.text
|
42 |
+
|
43 |
+
# Print the content of the file
|
44 |
+
# print(content)
|
45 |
+
else:
|
46 |
+
# Handle the case when the request fails
|
47 |
+
print('Failed to download the file.')
|
48 |
+
|
49 |
+
|
50 |
|
51 |
#title
|
52 |
st.title("Smart Detection System of AI-Generated Text Models")
|
|
|
55 |
st.markdown("This is a POC for Smart Detection System of AI Generated Text Models project (:blue[MSc Data Analytics]), it is a pre-trained model that detect the probablities of using any of the known LLM (chatgpt3, chatgpt4, GoogleBard, HuggingfaceChat)")
|
56 |
|
57 |
#input text
|
58 |
+
input_paragraph = st.text_area("Input your text here", value=content)
|
59 |
words_counts = word_tokenize(input_paragraph)
|
60 |
final_words = len(words_counts)
|
61 |
st.write('Words counts: ', final_words)
|
|
|
230 |
response = requests.get(url, headers=headers)
|
231 |
|
232 |
# Save the file
|
233 |
+
with open('AI_vs_AI_RandomForest_88_Samples.pkl', 'wb') as file:
|
234 |
+
file.write(response.content)
|
235 |
|
236 |
# At this point, the pickle file should exist, either it was already there, or it has been downloaded and extracted.
|
237 |
+
with open('AI_vs_AI_RandomForest_88_Samples.pkl', 'rb') as file:
|
238 |
+
clf_loaded = pickle.load(file)
|
239 |
|
240 |
input_features = df['paragraph'].apply(extract_features_AI_vs_AI_RandomForest_88_Samples)
|
241 |
|