bstraehle commited on
Commit
4ad819c
·
verified ·
1 Parent(s): 0d55b74

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ from multi_agent import run_multi_agent
5
+
6
+ LLM = "gpt-4o"
7
+
8
+ def invoke(openai_api_key):
9
+ if (openai_api_key == ""):
10
+ raise gr.Error("OpenAI API Key is required.")
11
+
12
+ os.environ["OPENAI_API_KEY"] = openai_api_key
13
+
14
+ return run_multi_agent(LLM)
15
+
16
+ gr.close_all()
17
+
18
+ demo = gr.Interface(fn = invoke,
19
+ inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1)],
20
+ outputs = [gr.Markdown(label = "Chess Game", value=os.environ["OUTPUT"])],
21
+ title = "Chess Game: AI Player White vs. AI Player Black",
22
+ description = os.environ["DESCRIPTION"])
23
+
24
+ demo.launch()