bstraehle commited on
Commit
987703d
·
verified ·
1 Parent(s): fc5db52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,26 +1,24 @@
1
  import gradio as gr
2
  import os
3
 
4
- from multi_agent import ChessGame
5
 
6
  LLM_WHITE = "gpt-4o"
7
  LLM_BLACK = "gpt-4o"
8
 
9
- def invoke(openai_api_key, num_moves = 3):
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
- chessGame = ChessGame()
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 = 3, minimum = 1, maximum = 10)],
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"])