jaifar530 commited on
Commit
6995f13
·
unverified ·
1 Parent(s): 7d3be29
Files changed (1) hide show
  1. app.py +10 -10
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('AI_vs_AI_RandomForest_88_Samples.pkl'):
34
  # Download the zip file if it doesn't exist
35
- url = 'https://jaifar.net/AI_vs_AI_RandomForest_88_Samples.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,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('AI_vs_AI_RandomForest_88_Samples.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('AI_vs_AI_RandomForest_88_Samples.pkl', 'rb') as file:
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('AI_vs_AI_RandomForest_88_Samples.pkl'):
433
  # # Download the zip file if it doesn't exist
434
- # url = 'https://jaifar.net/AI_vs_AI_RandomForest_88_Samples.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,16 +440,16 @@ if press_me_button:
440
 
441
  # # Save the file
442
  # try:
443
- # with open('AI_vs_AI_RandomForest_88_Samples.pkl', 'wb') as file:
444
  # file.write(response.content)
445
  # except Exception as e:
446
- # st.write(f"An error occurred while writing AI_vs_AI_RandomForest_88_Samples.pkl: {str(e)}")
447
 
448
  # try:
449
- # with open('AI_vs_AI_RandomForest_88_Samples.pkl', 'rb') as file:
450
  # clf_loaded = pickle.load(file)
451
  # except Exception as e:
452
- # st.write(f"An error occurred while loading AI_vs_AI_RandomForest_88_Samples.pkl: {str(e)}")
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?")