Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,25 +18,26 @@ def invoke(level, question, file_name, ground_truth, openai_api_key):
|
|
| 18 |
|
| 19 |
with lock:
|
| 20 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 21 |
-
result = run_agent(MODEL_ID, level, question, file_name)
|
| 22 |
del os.environ["OPENAI_API_KEY"]
|
| 23 |
-
return result
|
| 24 |
|
| 25 |
gr.close_all()
|
| 26 |
|
| 27 |
demo = gr.Interface(fn = invoke,
|
| 28 |
inputs = [gr.Radio([1, 2, 3], label = "Level", value = int(os.environ["INPUT_LEVEL"])),
|
| 29 |
gr.Textbox(label = "Question", value = os.environ["INPUT_QUESTION"]),
|
| 30 |
-
gr.Textbox(label = "File Name", value = os.environ["
|
| 31 |
-
gr.Textbox(label = "Ground Truth", value = os.environ["
|
| 32 |
gr.Textbox(label = "OpenAI API Key", type = "password")],
|
| 33 |
-
outputs = [gr.Textbox(label = "
|
|
|
|
| 34 |
title = "General AI Assistant (GAIA)",
|
| 35 |
description = os.environ["DESCRIPTION"],
|
| 36 |
examples = [
|
|
|
|
| 37 |
[1, "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.", "", "3"],
|
| 38 |
[1, "In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?", "", "3"],
|
| 39 |
-
[1, ".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI", "", "right"],
|
| 40 |
[1, "Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.", f"{FILE_PATH}cca530fc-4052-43b2-b130-b30968d8aa44.png", "Rd5"],
|
| 41 |
[1, "Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?", "", "FunkMonk"],
|
| 42 |
[1, "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.", "", "b, e"],
|
|
|
|
| 18 |
|
| 19 |
with lock:
|
| 20 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 21 |
+
result, matches_ground_truth = run_agent(MODEL_ID, level, question, file_name, ground_truth)
|
| 22 |
del os.environ["OPENAI_API_KEY"]
|
| 23 |
+
return result, matches_ground_truth
|
| 24 |
|
| 25 |
gr.close_all()
|
| 26 |
|
| 27 |
demo = gr.Interface(fn = invoke,
|
| 28 |
inputs = [gr.Radio([1, 2, 3], label = "Level", value = int(os.environ["INPUT_LEVEL"])),
|
| 29 |
gr.Textbox(label = "Question", value = os.environ["INPUT_QUESTION"]),
|
| 30 |
+
gr.Textbox(label = "File Name", value = os.environ["INPUT_FILE_NAME"]),
|
| 31 |
+
gr.Textbox(label = "Ground Truth", value = os.environ["INPUT_GROUND_TRUTH"]),
|
| 32 |
gr.Textbox(label = "OpenAI API Key", type = "password")],
|
| 33 |
+
outputs = [gr.Textbox(label = "Answer", value = os.environ["OUTPUT_ANSWER"], lines = 1, interactive = False),
|
| 34 |
+
gr.Textbox(label = "Matches Ground Truth", value = os.environ["OUTPUT_MATCHES_GROUND_TRUTH"], lines = 1, interactive = False)],
|
| 35 |
title = "General AI Assistant (GAIA)",
|
| 36 |
description = os.environ["DESCRIPTION"],
|
| 37 |
examples = [
|
| 38 |
+
[1, ".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI", "", "right"],
|
| 39 |
[1, "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.", "", "3"],
|
| 40 |
[1, "In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?", "", "3"],
|
|
|
|
| 41 |
[1, "Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.", f"{FILE_PATH}cca530fc-4052-43b2-b130-b30968d8aa44.png", "Rd5"],
|
| 42 |
[1, "Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?", "", "FunkMonk"],
|
| 43 |
[1, "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.", "", "b, e"],
|