Spaces:
Running
Running
jaifar530
commited on
dsadsa
Browse files
app.py
CHANGED
@@ -30,9 +30,9 @@ nltk.download('stopwords')
|
|
30 |
nltk.download('averaged_perceptron_tagger')
|
31 |
|
32 |
# Check if the file exists
|
33 |
-
if not os.path.isfile('
|
34 |
# Download the zip file if it doesn't exist
|
35 |
-
url = 'https://jaifar.net/
|
36 |
headers = {
|
37 |
'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',
|
38 |
}
|
@@ -40,11 +40,11 @@ if not os.path.isfile('AI_vs_AI_RandomForest_88_Samples.pkl'):
|
|
40 |
response = requests.get(url, headers=headers)
|
41 |
|
42 |
# Save the file
|
43 |
-
with open('
|
44 |
file.write(response.content)
|
45 |
|
46 |
# At this point, the pickle file should exist, either it was already there, or it has been downloaded and extracted.
|
47 |
-
with open('
|
48 |
clf_loaded = pickle.load(file)
|
49 |
|
50 |
input_paragraph = st.text_area("Input your text here")
|
@@ -429,9 +429,9 @@ if press_me_button:
|
|
429 |
|
430 |
|
431 |
# # Check if the file exists
|
432 |
-
# if not os.path.isfile('
|
433 |
# # Download the zip file if it doesn't exist
|
434 |
-
# url = 'https://jaifar.net/
|
435 |
# headers = {
|
436 |
# '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',
|
437 |
# }
|
@@ -440,16 +440,16 @@ if press_me_button:
|
|
440 |
|
441 |
# # Save the file
|
442 |
# try:
|
443 |
-
# with open('
|
444 |
# file.write(response.content)
|
445 |
# except Exception as e:
|
446 |
-
# st.write(f"An error occurred while writing
|
447 |
|
448 |
# try:
|
449 |
-
# with open('
|
450 |
# clf_loaded = pickle.load(file)
|
451 |
# except Exception as e:
|
452 |
-
# st.write(f"An error occurred while loading
|
453 |
|
454 |
# # Creates a button
|
455 |
# press_me_button = st.button("Which Model Used?")
|
|
|
30 |
nltk.download('averaged_perceptron_tagger')
|
31 |
|
32 |
# Check if the file exists
|
33 |
+
if not os.path.isfile('RandomForestClassifier.pkl'):
|
34 |
# Download the zip file if it doesn't exist
|
35 |
+
url = 'https://jaifar.net/RandomForestClassifier.pkl'
|
36 |
headers = {
|
37 |
'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',
|
38 |
}
|
|
|
40 |
response = requests.get(url, headers=headers)
|
41 |
|
42 |
# Save the file
|
43 |
+
with open('RandomForestClassifier.pkl', 'wb') as file:
|
44 |
file.write(response.content)
|
45 |
|
46 |
# At this point, the pickle file should exist, either it was already there, or it has been downloaded and extracted.
|
47 |
+
with open('RandomForestClassifier.pkl', 'rb') as file:
|
48 |
clf_loaded = pickle.load(file)
|
49 |
|
50 |
input_paragraph = st.text_area("Input your text here")
|
|
|
429 |
|
430 |
|
431 |
# # Check if the file exists
|
432 |
+
# if not os.path.isfile('RandomForestClassifier.pkl'):
|
433 |
# # Download the zip file if it doesn't exist
|
434 |
+
# url = 'https://jaifar.net/RandomForestClassifier.pkl'
|
435 |
# headers = {
|
436 |
# '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',
|
437 |
# }
|
|
|
440 |
|
441 |
# # Save the file
|
442 |
# try:
|
443 |
+
# with open('RandomForestClassifier.pkl', 'wb') as file:
|
444 |
# file.write(response.content)
|
445 |
# except Exception as e:
|
446 |
+
# st.write(f"An error occurred while writing RandomForestClassifier.pkl: {str(e)}")
|
447 |
|
448 |
# try:
|
449 |
+
# with open('RandomForestClassifier.pkl', 'rb') as file:
|
450 |
# clf_loaded = pickle.load(file)
|
451 |
# except Exception as e:
|
452 |
+
# st.write(f"An error occurred while loading RandomForestClassifier.pkl: {str(e)}")
|
453 |
|
454 |
# # Creates a button
|
455 |
# press_me_button = st.button("Which Model Used?")
|