NomosRUS commited on
Commit
dc7161f
·
verified ·
1 Parent(s): 03313fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -13,8 +13,10 @@ from PyPDF2 import PdfReader
13
  #to delete futher
14
  current_question = ""
15
  current_answer = ""
 
 
16
  def get_status():
17
- return current_question, current_answer
18
 
19
 
20
  # (Keep Constants as is)
@@ -172,9 +174,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
172
  submit_url = f"{api_url}/submit"
173
 
174
  #delete
175
- global current_question, current_answer
176
  current_question = ""
177
  current_answer = ""
 
 
178
  #delete
179
 
180
  # 1. Instantiate Agent ( modify this part to create your agent)
@@ -224,6 +228,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
224
  continue
225
  try:
226
  submitted_answer = agent(question_text)
 
227
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
228
  #del
229
  current_answer = submitted_answer
@@ -316,6 +321,7 @@ with gr.Blocks() as demo:
316
  #del
317
  current_question_box = gr.Textbox(label="Current Question")
318
  current_answer_box = gr.Textbox(label="Current Answer")
 
319
  #del
320
  run_button.click(
321
  fn=run_and_submit_all,
@@ -323,7 +329,7 @@ with gr.Blocks() as demo:
323
  )
324
  #del
325
  status_timer = gr.Timer(1.0)
326
- status_timer.tick(fn=get_status, outputs=[current_question_box, current_answer_box])
327
  #del
328
  if __name__ == "__main__":
329
  print("\n" + "-"*30 + " App Starting " + "-"*30)
 
13
  #to delete futher
14
  current_question = ""
15
  current_answer = ""
16
+ current_context = ""
17
+
18
  def get_status():
19
+ return current_question, current_answer, current_context
20
 
21
 
22
  # (Keep Constants as is)
 
174
  submit_url = f"{api_url}/submit"
175
 
176
  #delete
177
+ global current_question, current_answer, current_context
178
  current_question = ""
179
  current_answer = ""
180
+ current_context = ""
181
+
182
  #delete
183
 
184
  # 1. Instantiate Agent ( modify this part to create your agent)
 
228
  continue
229
  try:
230
  submitted_answer = agent(question_text)
231
+ current_context = agent.get_context()
232
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
233
  #del
234
  current_answer = submitted_answer
 
321
  #del
322
  current_question_box = gr.Textbox(label="Current Question")
323
  current_answer_box = gr.Textbox(label="Current Answer")
324
+ context_box = gr.Textbox(label="Current Context")
325
  #del
326
  run_button.click(
327
  fn=run_and_submit_all,
 
329
  )
330
  #del
331
  status_timer = gr.Timer(1.0)
332
+ status_timer.tick(fn=get_status, outputs=[current_question_box, current_answer_box, context_box])
333
  #del
334
  if __name__ == "__main__":
335
  print("\n" + "-"*30 + " App Starting " + "-"*30)