Geethuzzz commited on
Commit
07143fb
·
verified ·
1 Parent(s): cf7a8a9

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +109 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import streamlit as st
3
+ from crewai import Agent, Task, Crew
4
+ from crewai_tools import SerperDevTool
5
+ from embedchain.embedder import GeminiEmbedder
6
+ from embedchain import App
7
+
8
+ # Set API Keys
9
+ gemini_api_key = "AIzaSyAC_i-I9uCP2UP14H89uigWP7MDM2xQno8"
10
+ serper_api_key = "b86545fdabc35dcb13fd8cc0a9b88c3a17b6dc89"
11
+ os.environ["GEMINIAI_API_KEY"] = gemini_api_key
12
+ os.environ["SERPER_API_KEY"] = serper_api_key
13
+
14
+ # Initialize Gemini Embedding Model
15
+ gemini_embedder = GeminiEmbedder(api_key=gemini_api_key)
16
+
17
+ # Initialize Serper Tool
18
+ search_tool = SerperDevTool(api_key=serper_api_key)
19
+
20
+ # Initialize EmbedChain App (Optional for Future Use)
21
+ embedchain_app = App(embedding_model=gemini_embedder)
22
+
23
+ # Create Agents
24
+ researcher = Agent(
25
+ role="Market Researcher",
26
+ goal="Gather detailed information about G10X and its competitors.",
27
+ tools=[search_tool],
28
+ verbose=True,
29
+ backstory="You specialize in market research and can extract detailed company insights."
30
+ )
31
+
32
+ analyzer = Agent(
33
+ role="Data Analyzer",
34
+ goal="Analyze the strengths, weaknesses, and market positioning of G10X.",
35
+ tools=[search_tool],
36
+ verbose=True,
37
+ backstory="Your expertise lies in identifying business trends and company insights."
38
+ )
39
+
40
+ comparator = Agent(
41
+ role="Comparator",
42
+ goal="Compare G10X with its competitors and provide actionable suggestions.",
43
+ tools=[search_tool],
44
+ verbose=True,
45
+ backstory="You excel at comparing companies and offering improvement suggestions."
46
+ )
47
+
48
+ # Define Tasks
49
+ research_task = Task(
50
+ description="Conduct research on G10X and its competitors.",
51
+ expected_output="Detailed research document with company insights.",
52
+ agent=researcher,
53
+ async_execution=True
54
+ )
55
+
56
+ analysis_task = Task(
57
+ description="Analyze G10X's business performance, strengths, and weaknesses.",
58
+ expected_output="Comprehensive analysis of G10X.",
59
+ agent=analyzer,
60
+ async_execution=True
61
+ )
62
+
63
+
64
+ comparison_task = Task(
65
+ description="Compare G10X with its competitors and provide improvement suggestions.",
66
+ expected_output="Comparison document with actionable recommendations for G10X.",
67
+ agent=comparator,
68
+ async_execution=True
69
+ )
70
+
71
+ # Final Analysis Article Task
72
+ final_article_task = Task(
73
+ description="Combine insights from all agents to generate a final analysis article for G10X.",
74
+ expected_output="A well-structured analysis article about G10X.",
75
+ context=[research_task, analysis_task, comparison_task],
76
+ agent=None # This will use all agents' outputs
77
+ )
78
+
79
+ # Crew Setup
80
+ company_analysis_crew = Crew(
81
+ agents=[researcher, analyzer, comparator],
82
+ tasks=[research_task, analysis_task, comparison_task, final_article_task],
83
+ verbose=True
84
+ )
85
+
86
+ # Streamlit Interface
87
+ st.title("G10X Company Analyzer")
88
+
89
+ # Input Section
90
+ st.header("Enter Details")
91
+ company_name = st.text_input("Company Name", "G10X")
92
+ competitor_list = st.text_area(
93
+ "List of Competitors (comma-separated)",
94
+ "Competitor A, Competitor B, Competitor C"
95
+ )
96
+
97
+ if st.button("Start Analysis"):
98
+ st.write("Running Analysis... Please wait.")
99
+
100
+ # Kick off the Crew Process
101
+ inputs = {"company_name": company_name, "competitors": competitor_list.split(",")}
102
+ results = company_analysis_crew.kickoff(inputs=inputs)
103
+
104
+ # Display Results
105
+ st.success("Analysis Completed!")
106
+
107
+ if "final_article.md" in results:
108
+ st.header("Final Analysis Article")
109
+ st.markdown(results["final_article.md"], unsafe_allow_html=True)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ streamlit
2
+ crewai
3
+ serper
4
+ devtools
5
+ embedchain