oracat commited on
Commit
bb5547f
·
1 Parent(s): 582efe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -24,10 +24,16 @@ def process(text):
24
  result = sorted(result, key=lambda x: -x["score"])
25
 
26
  cum_score = 0
 
27
  for i, item in enumerate(result):
28
  cum_score += item["score"]
29
  if cum_score >= 0.95:
30
  break
 
 
 
 
 
31
 
32
  result = result[: (i + 1)]
33
 
@@ -103,7 +109,7 @@ def clear_callback():
103
  st.markdown(
104
  """<style>
105
  .css-ocqkz7 > div:nth-child(4) button {
106
- background-color: #A0A0A0;
107
  }
108
  .css-ocqkz7 > div:nth-child(4) button:hover {
109
  color: #FF6961;
 
24
  result = sorted(result, key=lambda x: -x["score"])
25
 
26
  cum_score = 0
27
+ prev_score = 0
28
  for i, item in enumerate(result):
29
  cum_score += item["score"]
30
  if cum_score >= 0.95:
31
  break
32
+ if i > 0:
33
+ if prev_score / item["score"] > 10:
34
+ i -= 1
35
+ break
36
+ prev_score = item["score"]
37
 
38
  result = result[: (i + 1)]
39
 
 
109
  st.markdown(
110
  """<style>
111
  .css-ocqkz7 > div:nth-child(4) button {
112
+ background-color: #C0C0C0;
113
  }
114
  .css-ocqkz7 > div:nth-child(4) button:hover {
115
  color: #FF6961;