bstraehle commited on
Commit
6aa678c
Β·
verified Β·
1 Parent(s): b2010da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -4,7 +4,7 @@ import os, threading
4
  from crew import run_crew
5
  from util import get_questions
6
 
7
- lock = threading.Lock()
8
 
9
  def invoke(level, question, file_name, ground_truth, openai_api_key):
10
  if not question:
@@ -13,11 +13,14 @@ def invoke(level, question, file_name, ground_truth, openai_api_key):
13
  if not openai_api_key:
14
  raise gr.Error("OpenAI API Key is required.")
15
 
 
 
16
  with lock:
17
  answer = ""
18
 
19
  try:
20
  os.environ["OPENAI_API_KEY"] = openai_api_key
 
21
  answer = run_crew(question, f"data/{file_name}")
22
  except Exception as e:
23
  raise gr.Error(e)
@@ -37,7 +40,7 @@ demo = gr.Interface(fn=invoke,
37
  outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
38
  title="General AI Assistant (GAIA) πŸ€–πŸ€πŸ€–",
39
  description=os.environ["DESCRIPTION"],
40
- examples=get_questions(),
41
  cache_examples=False
42
  )
43
 
 
4
  from crew import run_crew
5
  from util import get_questions
6
 
7
+ QUESTION_FILE_PATH = "data/gaia_validation_20.jsonl"
8
 
9
  def invoke(level, question, file_name, ground_truth, openai_api_key):
10
  if not question:
 
13
  if not openai_api_key:
14
  raise gr.Error("OpenAI API Key is required.")
15
 
16
+ lock = threading.Lock()
17
+
18
  with lock:
19
  answer = ""
20
 
21
  try:
22
  os.environ["OPENAI_API_KEY"] = openai_api_key
23
+
24
  answer = run_crew(question, f"data/{file_name}")
25
  except Exception as e:
26
  raise gr.Error(e)
 
40
  outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
41
  title="General AI Assistant (GAIA) πŸ€–πŸ€πŸ€–",
42
  description=os.environ["DESCRIPTION"],
43
+ examples=get_questions(QUESTION_FILE_PATH),
44
  cache_examples=False
45
  )
46