bstraehle commited on
Commit
bf7f003
·
verified ·
1 Parent(s): 76a2e7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -5,24 +5,24 @@ from crew import get_crew
5
 
6
  LLM = "gpt-4o"
7
 
8
- def invoke(openai_api_key, topic, length):
9
  if (openai_api_key == ""):
10
  raise gr.Error("OpenAI API Key is required.")
11
  if (topic == ""):
12
  raise gr.Error("Topic is required.")
13
-
14
  agentops.init(os.environ["AGENTOPS_API_KEY"])
15
 
16
  os.environ["OPENAI_API_KEY"] = openai_api_key
17
 
18
- return get_crew(LLM).kickoff(inputs={"topic": topic, "length": length})
19
 
20
  gr.close_all()
21
 
22
  demo = gr.Interface(fn = invoke,
23
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
24
  gr.Textbox(label = "Topic", value=os.environ["TOPIC"], lines = 1),
25
- gr.Number(label = "Words", value="2500")],
26
  outputs = [gr.Textbox(label = "Generated Blog Post", value=os.environ["OUTPUT"], lines = 1)],
27
  title = "Multi-Agent RAG: Blog Post Generation",
28
  description = os.environ["DESCRIPTION"])
 
5
 
6
  LLM = "gpt-4o"
7
 
8
+ def invoke(openai_api_key, topic, word_count):
9
  if (openai_api_key == ""):
10
  raise gr.Error("OpenAI API Key is required.")
11
  if (topic == ""):
12
  raise gr.Error("Topic is required.")
13
+
14
  agentops.init(os.environ["AGENTOPS_API_KEY"])
15
 
16
  os.environ["OPENAI_API_KEY"] = openai_api_key
17
 
18
+ return get_crew(LLM).kickoff(inputs={"topic": topic, "words": words})
19
 
20
  gr.close_all()
21
 
22
  demo = gr.Interface(fn = invoke,
23
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
24
  gr.Textbox(label = "Topic", value=os.environ["TOPIC"], lines = 1),
25
+ gr.Number(label = "Word Count", value="2500", minimum="500", maximum="5000")],
26
  outputs = [gr.Textbox(label = "Generated Blog Post", value=os.environ["OUTPUT"], lines = 1)],
27
  title = "Multi-Agent RAG: Blog Post Generation",
28
  description = os.environ["DESCRIPTION"])