rbughao commited on
Commit
99dd8f0
·
verified ·
1 Parent(s): e350981

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -4,7 +4,7 @@ import textstat
4
  import urllib.request
5
  import re
6
  from bs4 import BeautifulSoup
7
- import huggingface_hub
8
 
9
 
10
  CLEANR = re.compile('<.*?>')
@@ -38,19 +38,12 @@ Detailed references:
38
  5. https://en.wikipedia.org/wiki/Gunning_fog_index
39
  """
40
 
41
- ### Spammy or not
42
- from transformers import pipeline
43
- HF_Token = os.environ.get('HF_Token')
44
- ### Spammy or not
45
-
46
-
47
-
48
  def measure_readability(message,history):
49
  if "https://" in message:
50
  response = urllib.request.urlopen(message)
51
  html = response.read().decode('utf8')
52
- cleantext = BeautifulSoup(html).text
53
- #cleantext = BeautifulSoup(html,'lxml').text
54
  text = re.sub(CLEANR,'', cleantext)
55
  else:
56
  text = message
@@ -79,7 +72,7 @@ def measure_readability(message,history):
79
  spammy = "Content is not spammy-ish based on 4.39 million parameter AI Model called OTIS-Official-Spam-Model"
80
  ##{"type":"Not Spam", "probability":x["score"]}
81
  else:
82
- spammy = "Content is spammy-ish based on 4.39 million parameter AI Model OTIS-Official-Spam-Model"
83
  ##{"type":"Spam", "probability":x["score"]}
84
 
85
  if "https://" in message:
 
4
  import urllib.request
5
  import re
6
  from bs4 import BeautifulSoup
7
+ from transformers import pipeline
8
 
9
 
10
  CLEANR = re.compile('<.*?>')
 
38
  5. https://en.wikipedia.org/wiki/Gunning_fog_index
39
  """
40
 
 
 
 
 
 
 
 
41
  def measure_readability(message,history):
42
  if "https://" in message:
43
  response = urllib.request.urlopen(message)
44
  html = response.read().decode('utf8')
45
+ #cleantext = BeautifulSoup(html).text
46
+ cleantext = BeautifulSoup(html,'lxml').text
47
  text = re.sub(CLEANR,'', cleantext)
48
  else:
49
  text = message
 
72
  spammy = "Content is not spammy-ish based on 4.39 million parameter AI Model called OTIS-Official-Spam-Model"
73
  ##{"type":"Not Spam", "probability":x["score"]}
74
  else:
75
+ spammy = "Content is spammy-ish based on 4.39 million parameter AI Model: OTIS-Official-Spam-Model"
76
  ##{"type":"Spam", "probability":x["score"]}
77
 
78
  if "https://" in message: