Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,12 +5,12 @@ 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,
|
| 9 |
if not question:
|
| 10 |
raise gr.Error("Question is required.")
|
| 11 |
|
| 12 |
-
if not
|
| 13 |
-
raise gr.Error("
|
| 14 |
|
| 15 |
if file_name:
|
| 16 |
file_name = f"data/{file_name}"
|
|
@@ -21,13 +21,13 @@ def invoke(level, question, file_name, ground_truth, openai_api_key):
|
|
| 21 |
answer = ""
|
| 22 |
|
| 23 |
try:
|
| 24 |
-
os.environ["
|
| 25 |
|
| 26 |
answer = run_crew(question, file_name)
|
| 27 |
except Exception as e:
|
| 28 |
raise gr.Error(e)
|
| 29 |
finally:
|
| 30 |
-
del os.environ["
|
| 31 |
|
| 32 |
return answer
|
| 33 |
|
|
@@ -38,7 +38,7 @@ demo = gr.Interface(fn=invoke,
|
|
| 38 |
gr.Markdown(label="Question"),
|
| 39 |
gr.Textbox(label="File Name"),
|
| 40 |
gr.Textbox(label="Ground Truth"),
|
| 41 |
-
gr.Textbox(label="
|
| 42 |
outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
|
| 43 |
title="General AI Assistant (GAIA) 🤖🤝🤖",
|
| 44 |
description=os.environ["DESCRIPTION"],
|
|
|
|
| 5 |
|
| 6 |
QUESTION_FILE_PATH = "data/gaia_validation_20.jsonl"
|
| 7 |
|
| 8 |
+
def invoke(level, question, file_name, ground_truth, google_api_key):
|
| 9 |
if not question:
|
| 10 |
raise gr.Error("Question is required.")
|
| 11 |
|
| 12 |
+
if not google_api_key:
|
| 13 |
+
raise gr.Error("Google API Key is required.")
|
| 14 |
|
| 15 |
if file_name:
|
| 16 |
file_name = f"data/{file_name}"
|
|
|
|
| 21 |
answer = ""
|
| 22 |
|
| 23 |
try:
|
| 24 |
+
os.environ["GOOGLE_API_KEY"] = google_api_key
|
| 25 |
|
| 26 |
answer = run_crew(question, file_name)
|
| 27 |
except Exception as e:
|
| 28 |
raise gr.Error(e)
|
| 29 |
finally:
|
| 30 |
+
del os.environ["GOOGLE_API_KEY"]
|
| 31 |
|
| 32 |
return answer
|
| 33 |
|
|
|
|
| 38 |
gr.Markdown(label="Question"),
|
| 39 |
gr.Textbox(label="File Name"),
|
| 40 |
gr.Textbox(label="Ground Truth"),
|
| 41 |
+
gr.Textbox(label="Google API Key", type="password")],
|
| 42 |
outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
|
| 43 |
title="General AI Assistant (GAIA) 🤖🤝🤖",
|
| 44 |
description=os.environ["DESCRIPTION"],
|