PirateXX commited on
Commit
4d9c03f
·
1 Parent(s): 45925c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -26,7 +26,10 @@ def chunks_of_900(text, chunk_size=900):
26
  current_chunk = ""
27
  for sentence in sentences:
28
  if len(current_chunk + sentence) <= chunk_size:
29
- current_chunk += " " + sentence
 
 
 
30
  else:
31
  chunks.append(current_chunk)
32
  current_chunk = sentence
@@ -58,9 +61,11 @@ def findRealProb(text):
58
  results.append([output, len(chunk)])
59
 
60
  ans = 0
 
61
  for prob, length in results:
62
  ans = ans + prob*length
63
- realProb = ans/len(text)
 
64
  return {"Real": realProb, "Fake": 1-realProb, "results": results, "text": text}
65
 
66
  def upload_file(file):
 
26
  current_chunk = ""
27
  for sentence in sentences:
28
  if len(current_chunk + sentence) <= chunk_size:
29
+ if len(current_chunk)!=0:
30
+ current_chunk += " "+sentence
31
+ else:
32
+ current_chunk += sentence
33
  else:
34
  chunks.append(current_chunk)
35
  current_chunk = sentence
 
61
  results.append([output, len(chunk)])
62
 
63
  ans = 0
64
+ cnt=0
65
  for prob, length in results:
66
  ans = ans + prob*length
67
+ cnt+=length
68
+ realProb = ans/cnt
69
  return {"Real": realProb, "Fake": 1-realProb, "results": results, "text": text}
70
 
71
  def upload_file(file):