JiheonJeong commited on
Commit
cebdace
·
1 Parent(s): cff0d7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -43,9 +43,7 @@ def parse_codeblock(text):
43
  if i > 0:
44
  lines[i] = "<br/>" + line.replace("<", "&lt;").replace(">", "&gt;")
45
  return "".join(lines)
46
-
47
- def reset_textbox():
48
- return gr.update(value='', interactive=False), gr.update(interactive=False)
49
 
50
  def random_sample():
51
  global SAMPLE_IDX
@@ -64,9 +62,12 @@ def random_sample():
64
  print(CURRENT_POSITION)
65
  return np.array(new_image)
66
 
67
- def reset_sample():
68
  image = np.array(Image.open(os.path.join(os.path.dirname(__file__), "data/Court.jpeg")))
69
- return image
 
 
 
70
 
71
 
72
  title = """<h1 align="center">Courtroom with AI juries</h1>"""
@@ -164,7 +165,7 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
164
  accept_checkbox.change(fn=enable_inputs, inputs=[], outputs=[user_consent_block, main_block], queue=False)
165
 
166
  b0.click(random_sample, inputs = [], outputs = [image])
167
- b2.click(reset_sample, inputs = [], outputs = [image])
168
 
169
  b1.click(submit, inputs = [image, *agents], outputs = [image, *agents])
170
 
 
43
  if i > 0:
44
  lines[i] = "<br/>" + line.replace("<", "&lt;").replace(">", "&gt;")
45
  return "".join(lines)
46
+ =
 
 
47
 
48
  def random_sample():
49
  global SAMPLE_IDX
 
62
  print(CURRENT_POSITION)
63
  return np.array(new_image)
64
 
65
+ def reset_sample(*agents):
66
  image = np.array(Image.open(os.path.join(os.path.dirname(__file__), "data/Court.jpeg")))
67
+ new_agents = []
68
+ for k in range(TOTAL_K):
69
+ new_agents.append('')
70
+ return image, *[gr.Textbox.update(value=answer) for answer in new_agents]
71
 
72
 
73
  title = """<h1 align="center">Courtroom with AI juries</h1>"""
 
165
  accept_checkbox.change(fn=enable_inputs, inputs=[], outputs=[user_consent_block, main_block], queue=False)
166
 
167
  b0.click(random_sample, inputs = [], outputs = [image])
168
+ b2.click(reset_sample, inputs = [], outputs = [image, *agents)
169
 
170
  b1.click(submit, inputs = [image, *agents], outputs = [image, *agents])
171