bstraehle commited on
Commit
453dcab
Β·
verified Β·
1 Parent(s): dd80d25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -5,15 +5,15 @@ from util import get_questions
5
 
6
  QUESTION_FILE_PATH = "data/gaia_validation_20.jsonl"
7
 
8
- def invoke(level, question, file_name, ground_truth, openai_api_key, google_api_key):
9
  if not question:
10
  raise gr.Error("Question is required.")
11
 
12
  if not openai_api_key:
13
  raise gr.Error("OpenAI API Key is required.")
14
 
15
- if not google_api_key:
16
- raise gr.Error("Google API Key is required.")
17
 
18
  if file_name:
19
  file_name = f"data/{file_name}"
@@ -25,14 +25,14 @@ def invoke(level, question, file_name, ground_truth, openai_api_key, google_api_
25
 
26
  try:
27
  os.environ["OPENAI_API_KEY"] = openai_api_key
28
- os.environ["GOOGLE_API_KEY"] = google_api_key
29
 
30
  answer = run_crew(question, file_name)
31
  except Exception as e:
32
  raise gr.Error(e)
33
  finally:
34
  del os.environ["OPENAI_API_KEY"]
35
- del os.environ["GOOGLE_API_KEY"]
36
 
37
  return answer
38
 
@@ -44,7 +44,7 @@ demo = gr.Interface(fn=invoke,
44
  gr.Textbox(label="File Name"),
45
  gr.Textbox(label="Ground Truth"),
46
  gr.Textbox(label="OpenAI API Key", type="password"),
47
- gr.Textbox(label="Google API Key", type="password")],
48
  outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
49
  title="General AI Assistant (GAIA) πŸ€–πŸ€πŸ€–",
50
  description=os.environ["DESCRIPTION"],
 
5
 
6
  QUESTION_FILE_PATH = "data/gaia_validation_20.jsonl"
7
 
8
+ def invoke(level, question, file_name, ground_truth, openai_api_key, gemini_api_key):
9
  if not question:
10
  raise gr.Error("Question is required.")
11
 
12
  if not openai_api_key:
13
  raise gr.Error("OpenAI API Key is required.")
14
 
15
+ if not gemini_api_key:
16
+ raise gr.Error("Gemini API Key is required.")
17
 
18
  if file_name:
19
  file_name = f"data/{file_name}"
 
25
 
26
  try:
27
  os.environ["OPENAI_API_KEY"] = openai_api_key
28
+ os.environ["GEMINI_API_KEY"] = gemini_api_key
29
 
30
  answer = run_crew(question, file_name)
31
  except Exception as e:
32
  raise gr.Error(e)
33
  finally:
34
  del os.environ["OPENAI_API_KEY"]
35
+ del os.environ["GEMINI_API_KEY"]
36
 
37
  return answer
38
 
 
44
  gr.Textbox(label="File Name"),
45
  gr.Textbox(label="Ground Truth"),
46
  gr.Textbox(label="OpenAI API Key", type="password"),
47
+ gr.Textbox(label="Gemini API Key", type="password")],
48
  outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
49
  title="General AI Assistant (GAIA) πŸ€–πŸ€πŸ€–",
50
  description=os.environ["DESCRIPTION"],