Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,11 @@ 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,
|
| 10 |
if (openai_api_key == ""):
|
| 11 |
raise gr.Error("OpenAI API Key is required.")
|
| 12 |
-
if (
|
| 13 |
-
raise gr.Error("
|
| 14 |
|
| 15 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 16 |
|
|
@@ -20,9 +20,10 @@ 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 = "
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 26 |
description = os.environ["DESCRIPTION"])
|
| 27 |
|
| 28 |
demo.launch()
|
|
|
|
| 6 |
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
| 7 |
os.environ["LANGCHAIN_PROJECT"] = "langgraph-multi-agent"
|
| 8 |
|
| 9 |
+
def invoke(openai_api_key, topic, word_count=1000):
|
| 10 |
if (openai_api_key == ""):
|
| 11 |
raise gr.Error("OpenAI API Key is required.")
|
| 12 |
+
if (topic == ""):
|
| 13 |
+
raise gr.Error("Topic is required.")
|
| 14 |
|
| 15 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 16 |
|
|
|
|
| 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=1000, minimum=500, maximum=5000)],
|
| 25 |
+
outputs = [gr.Markdown(label = "Generated Blog Post", value=os.environ["OUTPUT"])],
|
| 26 |
+
title = "Multi-Agent RAG: Blog Post Generation",
|
| 27 |
description = os.environ["DESCRIPTION"])
|
| 28 |
|
| 29 |
demo.launch()
|