WilliamGazeley commited on
Commit
cec1525
·
1 Parent(s): eac07bb

Add max retry

Browse files
Files changed (1) hide show
  1. src/app.py +3 -2
src/app.py CHANGED
@@ -107,7 +107,7 @@ def main():
107
 
108
  input_text = st.text_area("Enter your text here:", value="", height=200)
109
 
110
- def get_response(input_text: str) -> str:
111
  try:
112
  for output in flow.stream({"question": input_text}):
113
  for key, value in output.items():
@@ -117,7 +117,8 @@ def main():
117
  except Exception as e:
118
  logger.error(e)
119
  logger.info("Retrying..")
120
- get_response(input_text)
 
121
 
122
  if st.button("Generate"):
123
  if input_text:
 
107
 
108
  input_text = st.text_area("Enter your text here:", value="", height=200)
109
 
110
+ def get_response(input_text: str, depth: int = 1) -> str:
111
  try:
112
  for output in flow.stream({"question": input_text}):
113
  for key, value in output.items():
 
117
  except Exception as e:
118
  logger.error(e)
119
  logger.info("Retrying..")
120
+ if depth < 5:
121
+ return get_response(input_text, depth + 1)
122
 
123
  if st.button("Generate"):
124
  if input_text: