Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
-
import os
|
3 |
|
4 |
from multi_agent import run_multi_agent
|
5 |
|
|
|
|
|
6 |
LLM_WHITE = "gpt-4o"
|
7 |
LLM_BLACK = "gpt-4o"
|
8 |
|
@@ -10,9 +12,11 @@ def invoke(openai_api_key, num_moves = 10):
|
|
10 |
if (openai_api_key == ""):
|
11 |
raise gr.Error("OpenAI API Key is required.")
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
gr.close_all()
|
18 |
|
|
|
1 |
import gradio as gr
|
2 |
+
import os, threading
|
3 |
|
4 |
from multi_agent import run_multi_agent
|
5 |
|
6 |
+
lock = threading.Lock()
|
7 |
+
|
8 |
LLM_WHITE = "gpt-4o"
|
9 |
LLM_BLACK = "gpt-4o"
|
10 |
|
|
|
12 |
if (openai_api_key == ""):
|
13 |
raise gr.Error("OpenAI API Key is required.")
|
14 |
|
15 |
+
with lock:
|
16 |
+
os.environ["OPENAI_API_KEY"] = openai_api_key
|
17 |
+
result = run_multi_agent(LLM_WHITE, LLM_BLACK, num_moves)
|
18 |
+
del os.environ["OPENAI_API_KEY"]
|
19 |
+
return result
|
20 |
|
21 |
gr.close_all()
|
22 |
|