GiantAnalytics commited on
Commit
1bbda19
·
verified ·
1 Parent(s): fb11726

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -13
app.py CHANGED
@@ -37,9 +37,14 @@ def main():
37
  st.write("It uses SOTA (State-of-the-Art) Reasoning Models to provide cutting-edge insights and AI integration strategies.")
38
 
39
  # Initialize session state for persistent data
40
- for key in ["company_data", "industry_trends", "ai_use_cases", "competitor_analysis", "ai_strategy", "ai_integration", "revenue_opportunities"]:
 
 
 
 
 
41
  if key not in st.session_state:
42
- st.session_state[key] = ""
43
 
44
  # Collect User Information
45
  name = st.text_input("Name")
@@ -52,35 +57,33 @@ def main():
52
  ("Search by Name", "Website URL", "Manual Description", "Upload Document"))
53
 
54
  progress_bar = st.progress(0)
55
-
 
56
  if input_method == "Search by Name":
57
  if st.button("Find Company Details"):
58
  progress_bar.progress(10)
59
  st.session_state.company_data = search_company(company_name)
60
  progress_bar.progress(30)
61
- st.rerun()
62
  elif input_method == "Website URL":
63
  website_url = st.text_input("Enter Website URL")
64
  if st.button("Scrape Website"):
65
  progress_bar.progress(10)
66
  st.session_state.company_data = scrape_website(website_url)
67
  progress_bar.progress(30)
68
- st.rerun()
69
  elif input_method == "Manual Description":
70
  company_data_input = st.text_area("Enter Company Description")
71
  if st.button("Process Description"):
72
  progress_bar.progress(10)
73
  st.session_state.company_data = process_company_description(company_data_input)
74
  progress_bar.progress(30)
75
- st.rerun()
76
  elif input_method == "Upload Document":
77
  uploaded_file = st.file_uploader("Upload PDF or PPT", type=["pdf", "pptx"])
78
  if uploaded_file is not None:
79
  progress_bar.progress(10)
80
  st.session_state.company_data = process_uploaded_document(uploaded_file)
81
  progress_bar.progress(30)
82
- st.rerun()
83
 
 
84
  if st.session_state.company_data:
85
  st.subheader("Extracted Company Information")
86
  st.write(st.session_state.company_data)
@@ -91,7 +94,6 @@ def main():
91
  progress_bar.progress(60)
92
  st.session_state.industry_trends = get_industry_trends(industry)
93
  progress_bar.progress(70)
94
- st.rerun()
95
 
96
  if st.session_state.industry_trends:
97
  st.subheader("Industry Trends")
@@ -101,7 +103,6 @@ def main():
101
  progress_bar.progress(75)
102
  st.session_state.ai_use_cases = get_ai_use_cases(industry)
103
  progress_bar.progress(80)
104
- st.rerun()
105
 
106
  if st.session_state.ai_use_cases:
107
  st.subheader("AI Use Cases")
@@ -112,22 +113,47 @@ def main():
112
  progress_bar.progress(85)
113
  st.session_state.competitor_analysis = get_competitor_ai_strategies(competitor)
114
  progress_bar.progress(90)
115
- st.rerun()
116
 
117
  if st.session_state.competitor_analysis:
118
  st.subheader("Competitor AI Strategies")
119
  st.write(st.session_state.competitor_analysis)
120
 
 
121
  if st.button("Generate AI Strategy"):
122
  progress_bar.progress(95)
123
  st.session_state.ai_strategy = generate_ai_strategy(
124
  st.session_state.company_data, st.session_state.industry_trends,
125
  st.session_state.ai_use_cases, st.session_state.competitor_analysis)
126
  progress_bar.progress(100)
127
- st.rerun()
128
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  st.markdown("---")
130
  st.markdown("**Developed by [Aditya Ghadge](https://www.linkedin.com/in/aditya-ghadge-a82b30240/) for Giant Analytics**")
131
 
132
  if __name__ == "__main__":
133
- main()
 
37
  st.write("It uses SOTA (State-of-the-Art) Reasoning Models to provide cutting-edge insights and AI integration strategies.")
38
 
39
  # Initialize session state for persistent data
40
+ session_keys = [
41
+ "company_data", "industry_trends", "ai_use_cases",
42
+ "competitor_analysis", "ai_strategy", "ai_integration",
43
+ "revenue_opportunities"
44
+ ]
45
+ for key in session_keys:
46
  if key not in st.session_state:
47
+ st.session_state[key] = None
48
 
49
  # Collect User Information
50
  name = st.text_input("Name")
 
57
  ("Search by Name", "Website URL", "Manual Description", "Upload Document"))
58
 
59
  progress_bar = st.progress(0)
60
+
61
+ # Handle Input Methods
62
  if input_method == "Search by Name":
63
  if st.button("Find Company Details"):
64
  progress_bar.progress(10)
65
  st.session_state.company_data = search_company(company_name)
66
  progress_bar.progress(30)
 
67
  elif input_method == "Website URL":
68
  website_url = st.text_input("Enter Website URL")
69
  if st.button("Scrape Website"):
70
  progress_bar.progress(10)
71
  st.session_state.company_data = scrape_website(website_url)
72
  progress_bar.progress(30)
 
73
  elif input_method == "Manual Description":
74
  company_data_input = st.text_area("Enter Company Description")
75
  if st.button("Process Description"):
76
  progress_bar.progress(10)
77
  st.session_state.company_data = process_company_description(company_data_input)
78
  progress_bar.progress(30)
 
79
  elif input_method == "Upload Document":
80
  uploaded_file = st.file_uploader("Upload PDF or PPT", type=["pdf", "pptx"])
81
  if uploaded_file is not None:
82
  progress_bar.progress(10)
83
  st.session_state.company_data = process_uploaded_document(uploaded_file)
84
  progress_bar.progress(30)
 
85
 
86
+ # Phase 2: Industry Analysis
87
  if st.session_state.company_data:
88
  st.subheader("Extracted Company Information")
89
  st.write(st.session_state.company_data)
 
94
  progress_bar.progress(60)
95
  st.session_state.industry_trends = get_industry_trends(industry)
96
  progress_bar.progress(70)
 
97
 
98
  if st.session_state.industry_trends:
99
  st.subheader("Industry Trends")
 
103
  progress_bar.progress(75)
104
  st.session_state.ai_use_cases = get_ai_use_cases(industry)
105
  progress_bar.progress(80)
 
106
 
107
  if st.session_state.ai_use_cases:
108
  st.subheader("AI Use Cases")
 
113
  progress_bar.progress(85)
114
  st.session_state.competitor_analysis = get_competitor_ai_strategies(competitor)
115
  progress_bar.progress(90)
 
116
 
117
  if st.session_state.competitor_analysis:
118
  st.subheader("Competitor AI Strategies")
119
  st.write(st.session_state.competitor_analysis)
120
 
121
+ # Phase 3: AI Strategy and Report Generation
122
  if st.button("Generate AI Strategy"):
123
  progress_bar.progress(95)
124
  st.session_state.ai_strategy = generate_ai_strategy(
125
  st.session_state.company_data, st.session_state.industry_trends,
126
  st.session_state.ai_use_cases, st.session_state.competitor_analysis)
127
  progress_bar.progress(100)
128
+
129
+ if st.session_state.ai_strategy:
130
+ st.subheader("AI Strategy")
131
+ st.write(st.session_state.ai_strategy)
132
+
133
+ if st.button("Suggest AI Integration Plan"):
134
+ st.session_state.ai_integration = suggest_ai_integration(
135
+ st.session_state.company_data, st.session_state.ai_strategy)
136
+
137
+ if st.session_state.ai_integration:
138
+ st.subheader("AI Integration Plan")
139
+ st.write(st.session_state.ai_integration)
140
+
141
+ if st.button("Identify Revenue Growth Opportunities"):
142
+ st.session_state.revenue_opportunities = identify_revenue_opportunities(
143
+ st.session_state.company_data, st.session_state.ai_strategy)
144
+
145
+ if st.session_state.revenue_opportunities:
146
+ st.subheader("Revenue Growth Opportunities")
147
+ st.write(st.session_state.revenue_opportunities)
148
+
149
+ if st.button("Generate Final Report"):
150
+ report_filename = generate_report(
151
+ company_name, st.session_state.ai_strategy, st.session_state.ai_integration,
152
+ st.session_state.revenue_opportunities)
153
+ st.success(f"Report Generated: {report_filename}")
154
+
155
  st.markdown("---")
156
  st.markdown("**Developed by [Aditya Ghadge](https://www.linkedin.com/in/aditya-ghadge-a82b30240/) for Giant Analytics**")
157
 
158
  if __name__ == "__main__":
159
+ main()