Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,12 +15,12 @@ def invoke(level, question, file_name, ground_truth, openai_api_key):
|
|
| 15 |
raise gr.Error("OpenAI API Key is required.")
|
| 16 |
|
| 17 |
with lock:
|
| 18 |
-
answer
|
| 19 |
|
| 20 |
try:
|
| 21 |
-
os.environ["OPENAI_API_KEY"]
|
| 22 |
-
#answer
|
| 23 |
-
answer
|
| 24 |
except Exception as e:
|
| 25 |
raise gr.Error(e)
|
| 26 |
finally:
|
|
@@ -30,17 +30,17 @@ def invoke(level, question, file_name, ground_truth, openai_api_key):
|
|
| 30 |
|
| 31 |
gr.close_all()
|
| 32 |
|
| 33 |
-
demo = gr.Interface(fn
|
| 34 |
-
inputs
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
outputs
|
| 40 |
-
title
|
| 41 |
-
description
|
| 42 |
-
examples
|
| 43 |
-
cache_examples
|
| 44 |
)
|
| 45 |
|
| 46 |
demo.launch()
|
|
|
|
| 15 |
raise gr.Error("OpenAI API Key is required.")
|
| 16 |
|
| 17 |
with lock:
|
| 18 |
+
answer=""
|
| 19 |
|
| 20 |
try:
|
| 21 |
+
os.environ["OPENAI_API_KEY"]=openai_api_key
|
| 22 |
+
#answer=run_gaia(question, file_name)
|
| 23 |
+
answer=get_crew().kickoff(inputs={"topic": question})
|
| 24 |
except Exception as e:
|
| 25 |
raise gr.Error(e)
|
| 26 |
finally:
|
|
|
|
| 30 |
|
| 31 |
gr.close_all()
|
| 32 |
|
| 33 |
+
demo = gr.Interface(fn=invoke,
|
| 34 |
+
inputs=[gr.Radio([1, 2, 3], label="Level"),
|
| 35 |
+
gr.Textbox(label="Question"),
|
| 36 |
+
gr.Textbox(label="File Name"),
|
| 37 |
+
gr.Textbox(label="Ground Truth"),
|
| 38 |
+
gr.Textbox(label="OpenAI API Key", type="password")],
|
| 39 |
+
outputs=[gr.Textbox(label="Answer", lines=1, interactive=False)],
|
| 40 |
+
title="General AI Assistant (GAIA) 🤖🤝🤖",
|
| 41 |
+
description=os.environ["DESCRIPTION"],
|
| 42 |
+
examples=get_questions(),
|
| 43 |
+
cache_examples=False
|
| 44 |
)
|
| 45 |
|
| 46 |
demo.launch()
|