rbughao commited on
Commit
52e141d
1 Parent(s): 481cd29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -15
app.py CHANGED
@@ -45,8 +45,17 @@ def measure_readability(message,history):
45
  cleantext = BeautifulSoup(html).text
46
  #cleantext = BeautifulSoup(html,'lxml').text
47
  text = re.sub(CLEANR,'', cleantext)
 
48
  else:
49
  text = message
 
 
 
 
 
 
 
 
50
 
51
  vline1 = "==== Content Info ==== " + os.linesep
52
  vline2 = "Character Count "+str(textstat.char_count(text, ignore_spaces=True)) + os.linesep
@@ -65,23 +74,9 @@ def measure_readability(message,history):
65
  #print("Grade Level Comprehension is "+str(textstat.automated_readability_index(text)))
66
  #vline13 = "Difficult Words "+str(textstat.difficult_words(text)) + os.linesep
67
  vline14 = "Reading Time = "+str(textstat.reading_time(text, ms_per_char=14.69))+" seconds"+ os.linesep
68
-
69
- pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
70
- x = pipe(text)[0]
71
- if x["label"] == "LABEL_0":
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:
79
- spammy=""
80
-
81
  answer = vline1+vline2+vline3+vline4+vline5+vline6+vline7+vline8+vline9+vline10+vline11+vline12+vline14+spammy
82
- #answer = str(x)
83
-
84
-
85
  return answer
86
 
87
 
 
45
  cleantext = BeautifulSoup(html).text
46
  #cleantext = BeautifulSoup(html,'lxml').text
47
  text = re.sub(CLEANR,'', cleantext)
48
+ spammy=""
49
  else:
50
  text = message
51
+ pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
52
+ x = pipe(text)[0]
53
+ if x["label"] == "LABEL_0":
54
+ spammy = "Content is not spammy-ish based on 4.39 million parameter AI Model called OTIS-Official-Spam-Model"
55
+ ##{"type":"Not Spam", "probability":x["score"]}
56
+ else:
57
+ spammy = "Content is spammy-ish based on 4.39 million parameter AI Model: OTIS-Official-Spam-Model"
58
+ ##{"type":"Spam", "probability":x["score"]}
59
 
60
  vline1 = "==== Content Info ==== " + os.linesep
61
  vline2 = "Character Count "+str(textstat.char_count(text, ignore_spaces=True)) + os.linesep
 
74
  #print("Grade Level Comprehension is "+str(textstat.automated_readability_index(text)))
75
  #vline13 = "Difficult Words "+str(textstat.difficult_words(text)) + os.linesep
76
  vline14 = "Reading Time = "+str(textstat.reading_time(text, ms_per_char=14.69))+" seconds"+ os.linesep
 
 
 
 
 
 
 
 
 
77
 
 
 
 
78
  answer = vline1+vline2+vline3+vline4+vline5+vline6+vline7+vline8+vline9+vline10+vline11+vline12+vline14+spammy
79
+
 
 
80
  return answer
81
 
82