acecalisto3 commited on
Commit
93a737c
·
verified ·
1 Parent(s): d997589

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -12,6 +12,7 @@ logging.basicConfig(level=logging.INFO)
12
  logger = logging.getLogger(__name__)
13
 
14
  FILE_DIR = os.path.dirname(os.path.abspath(__file__))
 
15
  OUTPUT_DIR = os.path.join(os.path.dirname(FILE_DIR), "auto_gpt_workspace")
16
  if not os.path.exists(OUTPUT_DIR):
17
  os.mkdir(OUTPUT_DIR)
@@ -35,8 +36,12 @@ def get_top_5_goals():
35
  return gr.Dataframe(row_count=(5, "fixed"), col_count=(1, "fixed"), headers=["AI Goals - Enter up to 5"], type="array")
36
 
37
  def get_example_values():
38
- with open(os.path.join(FILE_DIR, "examples.json"), "r") as f:
39
- return json.load(f)
 
 
 
 
40
 
41
  def get_chatbot():
42
  return gr.Chatbot(elem_id="chatbot")
 
12
  logger = logging.getLogger(__name__)
13
 
14
  FILE_DIR = os.path.dirname(os.path.abspath(__file__))
15
+ EXAMPLES_PATH = os.path.join(FILE_DIR, 'examples.json')
16
  OUTPUT_DIR = os.path.join(os.path.dirname(FILE_DIR), "auto_gpt_workspace")
17
  if not os.path.exists(OUTPUT_DIR):
18
  os.mkdir(OUTPUT_DIR)
 
36
  return gr.Dataframe(row_count=(5, "fixed"), col_count=(1, "fixed"), headers=["AI Goals - Enter up to 5"], type="array")
37
 
38
  def get_example_values():
39
+ try:
40
+ with open(EXAMPLES_PATH, 'r', encoding='utf-8') as f:
41
+ return json.load(f)
42
+ except Exception as e:
43
+ print(f"Error loading examples: {e}")
44
+ return []
45
 
46
  def get_chatbot():
47
  return gr.Chatbot(elem_id="chatbot")