bstraehle commited on
Commit
844f26f
1 Parent(s): 974825d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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, prompt):
10
  if (openai_api_key == ""):
11
  raise gr.Error("OpenAI API Key is required.")
12
- if (prompt == ""):
13
- raise gr.Error("Prompt is required.")
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 = "Input", value="Code hello world and print it to the terminal", lines = 1)],
24
- outputs = [gr.Textbox(label = "Output", value="TODO")],
25
- title = "Multi-Agent RAG: Chart Generation",
 
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()