Nancy1906 commited on
Commit
b158950
·
verified ·
1 Parent(s): 8228da5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
 
6
 
7
  # --- AGENTE SIMPLIFICADO CON FUNCIONALIDAD PERSONALIZADA ---
8
  from my_tools import basic_agent_response
@@ -51,7 +52,17 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
51
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
52
  except Exception as e:
53
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
54
-
 
 
 
 
 
 
 
 
 
 
55
  if not answers_payload:
56
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
57
 
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ import time
7
 
8
  # --- AGENTE SIMPLIFICADO CON FUNCIONALIDAD PERSONALIZADA ---
9
  from my_tools import basic_agent_response
 
52
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
53
  except Exception as e:
54
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
55
+
56
+ # ----- LÍNEA DE TIME.SLEEP VA AQUÍ -----
57
+ # Esperar después de procesar cada pregunta, excepto la última
58
+ if item_index < total_questions - 1:
59
+ wait_duration = 20 # Segundos de espera
60
+ print(f"--- Question {item_index + 1} processed. Waiting {wait_duration} seconds before next question to manage API rate limits... ---")
61
+ time.sleep(wait_duration)
62
+ else:
63
+ print(f"--- All {total_questions} questions processed. Proceeding to submission. ---")
64
+ # ----- FIN DE LA SECCIÓN DE TIME.SLEEP -----
65
+
66
  if not answers_payload:
67
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
68