Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
import os, threading
|
3 |
|
4 |
from multi_agent import run_multi_agent
|
5 |
|
@@ -7,16 +7,16 @@ lock = threading.Lock()
|
|
7 |
|
8 |
LLM = "gpt-4o"
|
9 |
|
10 |
-
def invoke(openai_api_key,
|
11 |
if not openai_api_key:
|
12 |
raise gr.Error("OpenAI API Key is required.")
|
13 |
|
14 |
-
if not
|
15 |
-
raise gr.Error("
|
16 |
|
17 |
with lock:
|
18 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
19 |
-
result = run_multi_agent(LLM,
|
20 |
del os.environ["OPENAI_API_KEY"]
|
21 |
return result
|
22 |
|
@@ -24,8 +24,8 @@ gr.close_all()
|
|
24 |
|
25 |
demo = gr.Interface(fn = invoke,
|
26 |
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
|
27 |
-
gr.Textbox(label = "
|
28 |
-
outputs = [gr.Markdown(label = "
|
29 |
title = "Multi-Agent AI: Financial Analysis",
|
30 |
description = os.environ["DESCRIPTION"])
|
31 |
|
|
|
1 |
import gradio as gr
|
2 |
+
import datetime, os, threading
|
3 |
|
4 |
from multi_agent import run_multi_agent
|
5 |
|
|
|
7 |
|
8 |
LLM = "gpt-4o"
|
9 |
|
10 |
+
def invoke(openai_api_key, task):
|
11 |
if not openai_api_key:
|
12 |
raise gr.Error("OpenAI API Key is required.")
|
13 |
|
14 |
+
if not 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 = "f"Today is {datetime.date.today()}. {value=os.environ["INPUT"]}")],
|
28 |
+
outputs = [gr.Markdown(label = "Output", value = os.environ["OUTPUT"])],
|
29 |
title = "Multi-Agent AI: Financial Analysis",
|
30 |
description = os.environ["DESCRIPTION"])
|
31 |
|