Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from rag_langgraph import run_multi_agent
|
|
6 |
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
7 |
os.environ["LANGCHAIN_PROJECT"] = "langgraph-multi-agent"
|
8 |
|
9 |
-
def invoke(openai_api_key, topic
|
10 |
if (openai_api_key == ""):
|
11 |
raise gr.Error("OpenAI API Key is required.")
|
12 |
if (topic == ""):
|
@@ -14,14 +14,13 @@ def invoke(openai_api_key, topic, word_count=2000):
|
|
14 |
|
15 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
16 |
|
17 |
-
return run_multi_agent(topic
|
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.Textbox(label = "Topic", value=os.environ["TOPIC"], lines = 1),
|
24 |
-
gr.Number(label = "Word Count", value=2000, minimum=500, maximum=5000)],
|
25 |
outputs = [gr.Markdown(label = "Generated Article", value=os.environ["OUTPUT"])],
|
26 |
title = "Multi-Agent RAG: Article Generation",
|
27 |
description = os.environ["DESCRIPTION"])
|
|
|
6 |
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
7 |
os.environ["LANGCHAIN_PROJECT"] = "langgraph-multi-agent"
|
8 |
|
9 |
+
def invoke(openai_api_key, topic):
|
10 |
if (openai_api_key == ""):
|
11 |
raise gr.Error("OpenAI API Key is required.")
|
12 |
if (topic == ""):
|
|
|
14 |
|
15 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
16 |
|
17 |
+
return run_multi_agent(topic)
|
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.Textbox(label = "Topic", value=os.environ["TOPIC"], lines = 1)],
|
|
|
24 |
outputs = [gr.Markdown(label = "Generated Article", value=os.environ["OUTPUT"])],
|
25 |
title = "Multi-Agent RAG: Article Generation",
|
26 |
description = os.environ["DESCRIPTION"])
|