bstraehle commited on
Commit
7cfc686
·
verified ·
1 Parent(s): 6172832

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -31
app.py CHANGED
@@ -7,34 +7,15 @@ AGENTOPS_API_KEY = os.environ["AGENTOPS_API_KEY"]
7
 
8
  agentops.init()
9
 
10
- def invoke(openai_api_key, serper_api_key, stock_selection, initial_capital, risk_tolerance, trading_strategy_preference, news_impact_consideration):
11
  if (openai_api_key == ""):
12
  raise gr.Error("OpenAI API Key is required.")
13
- if (serper_api_key == ""):
14
- raise gr.Error("Serper API Key is required.")
15
- if (stock_selection == ""):
16
- raise gr.Error("Stock Ticker is required.")
17
- if (initial_capital == ""):
18
- raise gr.Error("Initial Capital is required.")
19
- if (risk_tolerance == ""):
20
- raise gr.Error("Risk Tolerance is required.")
21
- if (trading_strategy_preference == ""):
22
- raise gr.Error("Trading Strategy Preference is required.")
23
- if (news_impact_consideration == ""):
24
- raise gr.Error("News Impact Consideration is required.")
25
 
26
  os.environ["OPENAI_API_KEY"] = openai_api_key
27
- os.environ["SERPER_API_KEY"] = serper_api_key
28
-
29
- financial_trading_inputs = {
30
- "stock_selection": stock_selection,
31
- "initial_capital": initial_capital,
32
- "risk_tolerance": risk_tolerance,
33
- "trading_strategy_preference": trading_strategy_preference,
34
- "news_impact_consideration": news_impact_consideration
35
- }
36
-
37
- return get_financial_trading_crew().kickoff(inputs=financial_trading_inputs)
38
 
39
  description = """<a href='https://www.gradio.app/'>Gradio</a> UI using the <a href='https://openai.com/'>OpenAI</a> SDK
40
  with <a href='https://openai.com/research/gpt-4'>gpt-4</a> model."""
@@ -43,14 +24,9 @@ gr.close_all()
43
 
44
  demo = gr.Interface(fn = invoke,
45
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
46
- gr.Textbox(label = "Serper API Key", type = "password", lines = 1),
47
- gr.Textbox(label = "Stock Ticker", value="SAN", lines = 1),
48
- gr.Textbox(label = "Initial Capital", value=1000, lines = 1),
49
- gr.Textbox(label = "Risk Tolerance", value="Medium", lines = 1),
50
- gr.Textbox(label = "Trading Strategy Preference", value="Day Trading", lines = 1),
51
- gr.Checkbox(label = "News Impact Consideration", value=True)],
52
  outputs = [gr.Textbox(label = "Output", lines = 1)],
53
- title = "Agentic RAG: Financial Analysis",
54
  description = description)
55
 
56
  demo.launch()
 
7
 
8
  agentops.init()
9
 
10
+ def invoke(openai_api_key, topic):
11
  if (openai_api_key == ""):
12
  raise gr.Error("OpenAI API Key is required.")
13
+ if (topic == ""):
14
+ raise gr.Error("Topic is required.")
 
 
 
 
 
 
 
 
 
 
15
 
16
  os.environ["OPENAI_API_KEY"] = openai_api_key
17
+
18
+ return get_crew().kickoff(inputs={"topic": topic})
 
 
 
 
 
 
 
 
 
19
 
20
  description = """<a href='https://www.gradio.app/'>Gradio</a> UI using the <a href='https://openai.com/'>OpenAI</a> SDK
21
  with <a href='https://openai.com/research/gpt-4'>gpt-4</a> model."""
 
24
 
25
  demo = gr.Interface(fn = invoke,
26
  inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
27
+ gr.Textbox(label = "Topic", value="Agentic RAG", lines = 1)]
 
 
 
 
 
28
  outputs = [gr.Textbox(label = "Output", lines = 1)],
29
+ title = "Agentic RAG: Research Write Article",
30
  description = description)
31
 
32
  demo.launch()