Update app.py
Browse files
app.py
CHANGED
@@ -6,19 +6,19 @@ from multi_agent import run_multi_agent
|
|
6 |
LLM_WHITE = "gpt-4o"
|
7 |
LLM_BLACK = "gpt-4o"
|
8 |
|
9 |
-
def invoke(openai_api_key,
|
10 |
if (openai_api_key == ""):
|
11 |
raise gr.Error("OpenAI API Key is required.")
|
12 |
|
13 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
14 |
|
15 |
-
return run_multi_agent(LLM_WHITE, LLM_BLACK,
|
16 |
|
17 |
gr.close_all()
|
18 |
|
19 |
demo = gr.Interface(fn = invoke,
|
20 |
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
|
21 |
-
gr.Number(label = "Number of
|
22 |
outputs = [gr.Markdown(label = "Game", value=os.environ["OUTPUT"], line_breaks=True, sanitize_html=False)],
|
23 |
title = "Chess: AI vs. AI",
|
24 |
description = os.environ["DESCRIPTION"])
|
|
|
6 |
LLM_WHITE = "gpt-4o"
|
7 |
LLM_BLACK = "gpt-4o"
|
8 |
|
9 |
+
def invoke(openai_api_key, num_moves = 10):
|
10 |
if (openai_api_key == ""):
|
11 |
raise gr.Error("OpenAI API Key is required.")
|
12 |
|
13 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
14 |
|
15 |
+
return run_multi_agent(LLM_WHITE, LLM_BLACK, num_moves)
|
16 |
|
17 |
gr.close_all()
|
18 |
|
19 |
demo = gr.Interface(fn = invoke,
|
20 |
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
|
21 |
+
gr.Number(label = "Number of Moves", value = 10, minimum = 1, maximum = 300)],
|
22 |
outputs = [gr.Markdown(label = "Game", value=os.environ["OUTPUT"], line_breaks=True, sanitize_html=False)],
|
23 |
title = "Chess: AI vs. AI",
|
24 |
description = os.environ["DESCRIPTION"])
|