bstraehle commited on
Commit
0f48b51
1 Parent(s): c74f41d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -3,13 +3,16 @@ import agentops, openai, os
3
 
4
  from crew import get_crew
5
 
6
- def invoke(openai_api_key, topic):
7
  if (openai_api_key == ""):
8
  raise gr.Error("OpenAI API Key is required.")
 
 
9
  if (topic == ""):
10
  raise gr.Error("Topic is required.")
11
 
12
  os.environ["OPENAI_API_KEY"] = openai_api_key
 
13
 
14
  agentops.init(os.environ["AGENTOPS_API_KEY"])
15
 
@@ -22,9 +25,10 @@ gr.close_all()
22
 
23
  demo = gr.Interface(fn = invoke,
24
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
 
25
  gr.Textbox(label = "Topic", value="Agentic RAG", lines = 1)],
26
  outputs = [gr.Textbox(label = "Output", lines = 1)],
27
- title = "Agentic RAG: Research Write Article",
28
  description = description)
29
 
30
  demo.launch()
 
3
 
4
  from crew import get_crew
5
 
6
+ def invoke(openai_api_key, serper_api_key, topic):
7
  if (openai_api_key == ""):
8
  raise gr.Error("OpenAI API Key is required.")
9
+ if (serper_api_key == ""):
10
+ raise gr.Error("Serper API Key is required.")
11
  if (topic == ""):
12
  raise gr.Error("Topic is required.")
13
 
14
  os.environ["OPENAI_API_KEY"] = openai_api_key
15
+ os.environ["SERPER_API_KEY"] = serper_api_key
16
 
17
  agentops.init(os.environ["AGENTOPS_API_KEY"])
18
 
 
25
 
26
  demo = gr.Interface(fn = invoke,
27
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
28
+ gr.Textbox(label = "Serper API Key", type = "password", lines = 1),
29
  gr.Textbox(label = "Topic", value="Agentic RAG", lines = 1)],
30
  outputs = [gr.Textbox(label = "Output", lines = 1)],
31
+ title = "Agentic RAG: Write Blog Post",
32
  description = description)
33
 
34
  demo.launch()