lukestanley commited on
Commit
2a25399
1 Parent(s): b68eb49

Show iteration count and time used

Browse files
Files changed (3) hide show
  1. app.py +2 -0
  2. chill.py +6 -1
  3. gradio_cached_examples/14/log.csv +18 -12
app.py CHANGED
@@ -67,6 +67,8 @@ def chill_out(text):
67
  <li>Faithfulness score: {result['faithfulness_score']:.0%}</li>
68
  <li>Spicy score: {result['spicy_score']:.0%}</li>
69
  <li>Overall score: {result['overall_score']:.0%}</li>
 
 
70
  <li>LLM requests made: {result['request_count']}</li>
71
  </ul>
72
  </div>
 
67
  <li>Faithfulness score: {result['faithfulness_score']:.0%}</li>
68
  <li>Spicy score: {result['spicy_score']:.0%}</li>
69
  <li>Overall score: {result['overall_score']:.0%}</li>
70
+ <li>Iterations: {result['iteration_count'] / result['max_allowed_iterations']:.0%} {result['iteration_count']} of max allowed iterations: {result['max_allowed_iterations']}</li>
71
+ <li>Time used: {result['time_used']:.2f} seconds</li>
72
  <li>LLM requests made: {result['request_count']}</li>
73
  </ul>
74
  </div>
chill.py CHANGED
@@ -42,7 +42,7 @@ global suggestions
42
  suggestions = []
43
  last_edit = ""
44
  request_count = 0
45
- start_time = time.time()
46
 
47
 
48
  def improve_text_attempt():
@@ -125,6 +125,7 @@ def improvement_loop(input_text):
125
  global suggestions
126
  global request_count
127
  global start_time
 
128
  suggestions = []
129
  last_edit = ""
130
  request_count = 0
@@ -133,6 +134,7 @@ def improvement_loop(input_text):
133
  original_text = input_text
134
 
135
  for iteration in range(1, max_iterations + 1):
 
136
  try:
137
  if iteration % 2 == 1:
138
  last_edit = improve_text_attempt()
@@ -154,6 +156,9 @@ def improvement_loop(input_text):
154
  print("ValueError:", e)
155
  continue
156
  assert len(suggestions) > 0
 
 
 
157
  return suggestions[0]
158
 
159
 
 
42
  suggestions = []
43
  last_edit = ""
44
  request_count = 0
45
+ start_time = None
46
 
47
 
48
  def improve_text_attempt():
 
125
  global suggestions
126
  global request_count
127
  global start_time
128
+ iteration_count = 0
129
  suggestions = []
130
  last_edit = ""
131
  request_count = 0
 
134
  original_text = input_text
135
 
136
  for iteration in range(1, max_iterations + 1):
137
+ iteration_count = iteration
138
  try:
139
  if iteration % 2 == 1:
140
  last_edit = improve_text_attempt()
 
156
  print("ValueError:", e)
157
  continue
158
  assert len(suggestions) > 0
159
+ suggestions[0]["iteration_count"] = iteration_count
160
+ suggestions[0]["max_allowed_iterations"] = max_iterations
161
+ suggestions[0]["time_used"] = time_used
162
  return suggestions[0]
163
 
164
 
gradio_cached_examples/14/log.csv CHANGED
@@ -2,26 +2,32 @@ output,flag,username,timestamp
2
  "
3
  <div>
4
  <h4>Edited text:</h4>
5
- <p>I am concerned that our current pace might delay the project's completion.</p>
6
  <h4>Details:</h4>
7
  <ul>
8
- <li>Critique: The revised text does not convey the same level of urgency as the original.</li>
9
- <li>Faithfulness Score: 0.85</li>
10
- <li>Spicy Score: 0.2</li>
11
- <li>Overall Score: 0.88</li>
 
 
 
12
  </ul>
13
  </div>
14
- ",,,2024-02-29 13:07:52.046527
15
  "
16
  <div>
17
  <h4>Edited text:</h4>
18
- <p>I think your idea of a balanced diet may need some adjustments.</p>
19
  <h4>Details:</h4>
20
  <ul>
21
- <li>Critique: This critique is too vague and does not address the specific issues with the provided text.</li>
22
- <li>Faithfulness Score: 0.5</li>
23
- <li>Spicy Score: 0</li>
24
- <li>Overall Score: 0.5</li>
 
 
 
25
  </ul>
26
  </div>
27
- ",,,2024-02-29 13:08:14.666888
 
2
  "
3
  <div>
4
  <h4>Edited text:</h4>
5
+ <p>It seems we're moving a bit slower than anticipated. I'm concerned we might not meet our shipping deadline.</p>
6
  <h4>Details:</h4>
7
  <ul>
8
+ <li>Critique: This is well-phrased and less inflammatory than the original. However, it might be more direct and still polite to say: 'We're behind schedule. I'm concerned we might not make our shipping deadline.'</li>
9
+ <li>Faithfulness score: 95%</li>
10
+ <li>Spicy score: 10%</li>
11
+ <li>Overall score: 97%</li>
12
+ <li>Iterations: 33% 2 of max allowed iterations: 6</li>
13
+ <li>Time used: 2.24 seconds</li>
14
+ <li>LLM requests made: 4</li>
15
  </ul>
16
  </div>
17
+ ",,,2024-02-29 17:35:32.665693
18
  "
19
  <div>
20
  <h4>Edited text:</h4>
21
+ <p>It seems your understanding of a balanced diet differs from mine, as it appears to include biscuits quite often.</p>
22
  <h4>Details:</h4>
23
  <ul>
24
+ <li>Critique: This critique is more subtle and less confrontational, which is good for preventing inflaming discussions. However, it could be more concise and closer to the original semantic intent. A possible revision could be: 'Your concept of a balanced diet appears to involve biscuits more often than usual.'</li>
25
+ <li>Faithfulness score: 95%</li>
26
+ <li>Spicy score: 10%</li>
27
+ <li>Overall score: 97%</li>
28
+ <li>Iterations: 33% 2 of max allowed iterations: 6</li>
29
+ <li>Time used: 2.36 seconds</li>
30
+ <li>LLM requests made: 4</li>
31
  </ul>
32
  </div>
33
+ ",,,2024-02-29 17:35:35.029163