HugoVoxx commited on
Commit
82e0027
·
verified ·
1 Parent(s): 33c3023

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -16,7 +16,10 @@ def geogeosolver(question:str, model:str="gpt-4o-mini"):
16
  input = translate(question)
17
  reader.main(input)
18
  run_ag()
19
- image_path = f'{OUTPUT_FOLDER}/output.png'
 
 
 
20
  result_dict = read_solution()
21
  key_list = list(result_dict.keys())
22
  premises = result_dict[key_list[0]]
@@ -32,7 +35,7 @@ def clear_directory(directory_path: Union[str, Path] = OUTPUT_FOLDER) -> None:
32
  try:
33
  if path_object.is_dir():
34
  shutil.rmtree(path_object)
35
- else:
36
  path_object.unlink()
37
  except PermissionError:
38
  pass
 
16
  input = translate(question)
17
  reader.main(input)
18
  run_ag()
19
+ if os.path.exists(f'{OUTPUT_FOLDER}/output.png'):
20
+ image_path = f'{OUTPUT_FOLDER}/output.png'
21
+ else:
22
+ image_path = f'{OUTPUT_FOLDER}/error.png'
23
  result_dict = read_solution()
24
  key_list = list(result_dict.keys())
25
  premises = result_dict[key_list[0]]
 
35
  try:
36
  if path_object.is_dir():
37
  shutil.rmtree(path_object)
38
+ elif path_object.name != 'error.png':
39
  path_object.unlink()
40
  except PermissionError:
41
  pass