lucaslingle commited on
Commit
5403b85
·
verified ·
1 Parent(s): e522dfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -110,9 +110,10 @@ class EnhancedAgent:
110
  )
111
 
112
  def __call__(self, question_text, file_name) -> str:
113
- template = Template(open("template.txt", "r").read())
 
114
  enhanced_question = template.substitute(question_text=question_text, file_name=file_name)
115
- response = self.agent.run(enhanced_question)
116
  return response
117
 
118
 
@@ -183,6 +184,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
183
  answer = None
184
  tries = 0
185
  while (answer is None) and (tries < 100):
 
186
  maybe_answer = agent(question_text, file_name)
187
  if maybe_answer.startswith("Error in generating final LLM output: 504 Server Error: Gateway Time-out for"):
188
  tries += 1
 
110
  )
111
 
112
  def __call__(self, question_text, file_name) -> str:
113
+ with open("template.txt", "r") as f:
114
+ template = Template(f.read())
115
  enhanced_question = template.substitute(question_text=question_text, file_name=file_name)
116
+ response = self.agent.run(enhanced_question, reset=True)
117
  return response
118
 
119
 
 
184
  answer = None
185
  tries = 0
186
  while (answer is None) and (tries < 100):
187
+ print(f"try {tries}")
188
  maybe_answer = agent(question_text, file_name)
189
  if maybe_answer.startswith("Error in generating final LLM output: 504 Server Error: Gateway Time-out for"):
190
  tries += 1