PirateXX commited on
Commit
579a5ab
1 Parent(s): f603a2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -22,8 +22,10 @@ def chunks_of_900(text, chunk_size=900):
22
  chunks = []
23
  current_chunk = ""
24
  for sentence in sentences:
25
- if len(current_chunk + sentence) <= chunk_size:
26
- current_chunk += " " + sentence
 
 
27
  else:
28
  chunks.append(current_chunk)
29
  current_chunk = sentence
@@ -53,9 +55,11 @@ def findRealProb(text):
53
  results.append([output, len(chunk)])
54
 
55
  ans = 0
 
56
  for prob, length in results:
 
57
  ans = ans + prob*length
58
- realProb = ans/len(text)
59
  return {"Real": realProb, "Fake": 1-realProb}, results
60
 
61
  demo = gr.Interface(
 
22
  chunks = []
23
  current_chunk = ""
24
  for sentence in sentences:
25
+ if len(current_chunk)!=0:
26
+ current_chunk += " "+sentence
27
+ else:
28
+ current_chunk += sentence
29
  else:
30
  chunks.append(current_chunk)
31
  current_chunk = sentence
 
55
  results.append([output, len(chunk)])
56
 
57
  ans = 0
58
+ cnt = 0
59
  for prob, length in results:
60
+ cnt += length
61
  ans = ans + prob*length
62
+ realProb = ans/cnt
63
  return {"Real": realProb, "Fake": 1-realProb}, results
64
 
65
  demo = gr.Interface(