Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,24 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
from multi_agent import
|
5 |
|
6 |
LLM_WHITE = "gpt-4o"
|
7 |
LLM_BLACK = "gpt-4o"
|
8 |
|
9 |
-
def invoke(openai_api_key, num_moves =
|
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 |
-
|
16 |
-
|
17 |
-
return chessGame.run_multi_agent(LLM_WHITE, LLM_BLACK, num_moves)
|
18 |
|
19 |
gr.close_all()
|
20 |
|
21 |
demo = gr.Interface(fn = invoke,
|
22 |
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
|
23 |
-
gr.Number(label = "Number of Moves", value =
|
24 |
outputs = [gr.Markdown(label = "Game", value=os.environ["OUTPUT"], line_breaks=True, sanitize_html=False)],
|
25 |
title = "Multi-Agent AI: Chess",
|
26 |
description = os.environ["DESCRIPTION"])
|
|
|
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 |
|
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 = 25)],
|
22 |
outputs = [gr.Markdown(label = "Game", value=os.environ["OUTPUT"], line_breaks=True, sanitize_html=False)],
|
23 |
title = "Multi-Agent AI: Chess",
|
24 |
description = os.environ["DESCRIPTION"])
|