bstraehle commited on
Commit
c87a829
1 Parent(s): 722929d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -5,16 +5,18 @@ from multi_agent import run_multi_agent
5
 
6
  lock = threading.Lock()
7
 
8
- LLM_WHITE = "gpt-4o"
9
- LLM_BLACK = "gpt-4o"
10
 
11
- def invoke(openai_api_key, num_moves = 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
 
@@ -22,8 +24,8 @@ gr.close_all()
22
 
23
  demo = gr.Interface(fn = invoke,
24
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
25
- gr.Number(label = "Number of Moves", value = 10, minimum = 1, maximum = 25)],
26
- outputs = [gr.Markdown(label = "Game", value=os.environ["OUTPUT"], line_breaks=True, sanitize_html=False)],
27
  title = "Multi-Agent AI: Financial Analysis",
28
  description = os.environ["DESCRIPTION"])
29
 
 
5
 
6
  lock = threading.Lock()
7
 
8
+ LLM = "gpt-4o"
 
9
 
10
+ def invoke(openai_api_key, task):
11
  if (openai_api_key == ""):
12
  raise gr.Error("OpenAI API Key is required.")
13
 
14
+ if (task == ""):
15
+ raise gr.Error("Task is required.")
16
+
17
  with lock:
18
  os.environ["OPENAI_API_KEY"] = openai_api_key
19
+ result = run_multi_agent(LLM, task)
20
  del os.environ["OPENAI_API_KEY"]
21
  return result
22
 
 
24
 
25
  demo = gr.Interface(fn = invoke,
26
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
27
+ gr.Textbox(label = "Task", value = "Write a blogpost about the stock price performance of Nvidia in the past month. Today's date is 2024-06-03.")],
28
+ outputs = [gr.Markdown(label = "Result", value=os.environ["OUTPUT"], line_breaks=True, sanitize_html=False)],
29
  title = "Multi-Agent AI: Financial Analysis",
30
  description = os.environ["DESCRIPTION"])
31