elibrowne commited on
Commit
260fa64
1 Parent(s): d460b8a

Generation workflow

Browse files
Files changed (1) hide show
  1. app.py +30 -4
app.py CHANGED
@@ -75,7 +75,7 @@ sample_dict = {
75
 
76
  user_id = "NO_ID"
77
 
78
- with gr.Blocks(theme=gr.themes.Soft()) as user_eval:
79
  # Title text introducing study
80
  gr.Markdown("""
81
  # Legal Retriever Evaluation Study
@@ -129,6 +129,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as user_eval:
129
  step += 1
130
  print(eval_1 + eval_2 + eval_3)
131
  if step == len(passage_texts):
 
132
  collapsible_string = ""
133
  for i, passage in enumerate(passage_texts):
134
  collapsible_string += """
@@ -148,10 +149,35 @@ with gr.Blocks(theme=gr.themes.Soft()) as user_eval:
148
  }
149
 
150
  def next_g(eval_helps, eval_satisfied):
 
 
151
  print(eval_helps + eval_satisfied)
152
- return {
153
- selection: gr.Markdown("next summary")
154
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
157
  btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied], outputs = [selection])
 
75
 
76
  user_id = "NO_ID"
77
 
78
+ with gr.Blocks() as user_eval:
79
  # Title text introducing study
80
  gr.Markdown("""
81
  # Legal Retriever Evaluation Study
 
129
  step += 1
130
  print(eval_1 + eval_2 + eval_3)
131
  if step == len(passage_texts):
132
+ # Step 10: all sources
133
  collapsible_string = ""
134
  for i, passage in enumerate(passage_texts):
135
  collapsible_string += """
 
149
  }
150
 
151
  def next_g(eval_helps, eval_satisfied):
152
+ global step
153
+ step += 1
154
  print(eval_helps + eval_satisfied)
155
+ if step == 11:
156
+ # Step 11: guaranteed summary
157
+ return {
158
+ selection: gr.HTML("""
159
+ <h2> Autogenerated Response </h2> <br />
160
+ """ + generation)
161
+ }
162
+ # Steps 12 and 13 are gold passage + gold passage generation IF it is applicable
163
+ if step > 11 and not sample_dict["top10_contains_gold_passage"]:
164
+ if step == 12:
165
+ return {
166
+ selection: gr.HTML("""
167
+ <h2> Retrieved Passage </h2> <br />
168
+ """ + gold_passage)
169
+ }
170
+ else:
171
+ return {
172
+ selection: gr.HTML("""
173
+ <h2> Autogenerated Response </h2> <br />
174
+ """ + gold_passage_generation)
175
+ }
176
+ else:
177
+ return {
178
+ selection: gr.HTML("TOGGLE INCOMING")
179
+ }
180
+
181
 
182
  btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
183
  btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied], outputs = [selection])