Commit
·
ca6df07
1
Parent(s):
d1f097e
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
|
|
|
|
3 |
|
4 |
from crewai import Agent, Task, Crew, Process
|
5 |
|
@@ -10,6 +12,62 @@ from crewai import Agent, Task, Crew, Process
|
|
10 |
# Crew Bot: https://chat.openai.com/g/g-qqTuUWsBY-crewai-assistant
|
11 |
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
# Therapy Group
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
+
from textwrap import dedent
|
4 |
+
from dotenv import load_dotenv
|
5 |
|
6 |
from crewai import Agent, Task, Crew, Process
|
7 |
|
|
|
12 |
# Crew Bot: https://chat.openai.com/g/g-qqTuUWsBY-crewai-assistant
|
13 |
|
14 |
|
15 |
+
from stock_analysis_agents import StockAnalysisAgents
|
16 |
+
from stock_analysis_tasks import StockAnalysisTasks
|
17 |
+
|
18 |
+
load_dotenv()
|
19 |
+
|
20 |
+
class FinancialCrew:
|
21 |
+
def __init__(self, company):
|
22 |
+
self.company = company
|
23 |
+
|
24 |
+
def run(self):
|
25 |
+
agents = StockAnalysisAgents()
|
26 |
+
tasks = StockAnalysisTasks()
|
27 |
+
|
28 |
+
research_analyst_agent = agents.research_analyst()
|
29 |
+
financial_analyst_agent = agents.financial_analyst()
|
30 |
+
investment_advisor_agent = agents.investment_advisor()
|
31 |
+
|
32 |
+
research_task = tasks.research(research_analyst_agent, self.company)
|
33 |
+
financial_task = tasks.financial_analysis(financial_analyst_agent)
|
34 |
+
filings_task = tasks.filings_analysis(financial_analyst_agent)
|
35 |
+
recommend_task = tasks.recommend(investment_advisor_agent)
|
36 |
+
|
37 |
+
crew = Crew(
|
38 |
+
agents=[
|
39 |
+
research_analyst_agent,
|
40 |
+
financial_analyst_agent,
|
41 |
+
investment_advisor_agent
|
42 |
+
],
|
43 |
+
tasks=[
|
44 |
+
research_task,
|
45 |
+
financial_task,
|
46 |
+
filings_task,
|
47 |
+
recommend_task
|
48 |
+
],
|
49 |
+
verbose=True
|
50 |
+
)
|
51 |
+
|
52 |
+
result = crew.kickoff()
|
53 |
+
return result
|
54 |
+
|
55 |
+
if __name__ == "__main__":
|
56 |
+
print("## Welcome to Financial Analysis Crew")
|
57 |
+
print('-------------------------------')
|
58 |
+
company = input(
|
59 |
+
dedent("""
|
60 |
+
What is the company you want to analyze?
|
61 |
+
"""))
|
62 |
+
|
63 |
+
financial_crew = FinancialCrew(company)
|
64 |
+
result = financial_crew.run()
|
65 |
+
print("\n\n########################")
|
66 |
+
print("## Here is the Report")
|
67 |
+
print("########################\n")
|
68 |
+
print(result)
|
69 |
+
|
70 |
+
|
71 |
|
72 |
|
73 |
# Therapy Group
|