File size: 6,708 Bytes
27b69f6
 
 
 
62ecc5e
 
 
27b69f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cdca3b8
27b69f6
cdca3b8
27b69f6
 
62ecc5e
6765eb1
1bbda19
 
 
 
 
 
6765eb1
1bbda19
62ecc5e
27b69f6
 
 
 
 
 
 
 
 
 
588d7c3
1bbda19
 
27b69f6
 
588d7c3
62ecc5e
588d7c3
27b69f6
 
 
588d7c3
62ecc5e
588d7c3
27b69f6
62ecc5e
27b69f6
588d7c3
62ecc5e
588d7c3
27b69f6
 
 
588d7c3
62ecc5e
588d7c3
27b69f6
1bbda19
62ecc5e
 
 
588d7c3
62ecc5e
27b69f6
 
588d7c3
62ecc5e
588d7c3
27b69f6
62ecc5e
 
 
 
27b69f6
588d7c3
62ecc5e
588d7c3
27b69f6
62ecc5e
 
 
 
27b69f6
 
588d7c3
62ecc5e
588d7c3
62ecc5e
 
 
 
27b69f6
1bbda19
27b69f6
588d7c3
62ecc5e
 
 
588d7c3
1bbda19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6765eb1
588d7c3
62ecc5e
27b69f6
1bbda19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import streamlit as st
import pandas as pd
import json
import os
from phase1_agents import search_company, scrape_website, process_company_description, process_uploaded_document
from phase2_agents import get_industry_trends, get_ai_use_cases, get_competitor_ai_strategies
from phase3_agents import generate_ai_strategy, suggest_ai_integration, identify_revenue_opportunities, generate_report

# Define data storage paths
CSV_FILE = "user_data.csv"
JSON_FILE = "user_data.json"

# Function to save data to CSV
def save_data_csv(data):
    df = pd.DataFrame([data])
    if os.path.exists(CSV_FILE):
        df.to_csv(CSV_FILE, mode='a', header=False, index=False)
    else:
        df.to_csv(CSV_FILE, index=False)

# Function to save data to JSON
def save_data_json(data):
    if os.path.exists(JSON_FILE):
        with open(JSON_FILE, "r") as file:
            existing_data = json.load(file)
    else:
        existing_data = []
    
    existing_data.append(data)
    with open(JSON_FILE, "w") as file:
        json.dump(existing_data, file, indent=4)

# Streamlit UI  by Giant Analytics
def main():
    st.title("Visionary AI .🔭")  
    st.write("Fill in the details to generate an AI-driven business strategy report.")
    st.write("It uses SOTA (State-of-the-Art) Reasoning Models to provide cutting-edge insights and AI integration strategies.")
    
    # Initialize session state for persistent data
    session_keys = [
        "company_data", "industry_trends", "ai_use_cases",
        "competitor_analysis", "ai_strategy", "ai_integration",
        "revenue_opportunities"
    ]
    for key in session_keys:
        if key not in st.session_state:
            st.session_state[key] = None
    
    # Collect User Information
    name = st.text_input("Name")
    email = st.text_input("Email")
    mobile = st.text_input("Mobile Number")
    company_name = st.text_input("Company Name")
    
    # Select method to provide company details
    input_method = st.radio("How would you like to provide company details?", 
                            ("Search by Name", "Website URL", "Manual Description", "Upload Document"))
    
    progress_bar = st.progress(0)

    # Handle Input Methods
    if input_method == "Search by Name":
        if st.button("Find Company Details"):
            progress_bar.progress(10)
            st.session_state.company_data = search_company(company_name)
            progress_bar.progress(30)
    elif input_method == "Website URL":
        website_url = st.text_input("Enter Website URL")
        if st.button("Scrape Website"):
            progress_bar.progress(10)
            st.session_state.company_data = scrape_website(website_url)
            progress_bar.progress(30)
    elif input_method == "Manual Description":
        company_data_input = st.text_area("Enter Company Description")
        if st.button("Process Description"):
            progress_bar.progress(10)
            st.session_state.company_data = process_company_description(company_data_input)
            progress_bar.progress(30)
    elif input_method == "Upload Document":
        uploaded_file = st.file_uploader("Upload PDF or PPT", type=["pdf", "pptx"])
        if uploaded_file is not None:
            progress_bar.progress(10)
            st.session_state.company_data = process_uploaded_document(uploaded_file)
            progress_bar.progress(30)
    
    # Phase 2: Industry Analysis
    if st.session_state.company_data:
        st.subheader("Extracted Company Information")
        st.write(st.session_state.company_data)
        progress_bar.progress(50)
        
        industry = st.text_input("Industry Type (e.g., Healthcare, Finance)")
        if st.button("Analyze Industry Trends"):
            progress_bar.progress(60)
            st.session_state.industry_trends = get_industry_trends(industry)
            progress_bar.progress(70)
        
        if st.session_state.industry_trends:
            st.subheader("Industry Trends")
            st.write(st.session_state.industry_trends)
            
        if st.button("Find AI Use Cases"):
            progress_bar.progress(75)
            st.session_state.ai_use_cases = get_ai_use_cases(industry)
            progress_bar.progress(80)
        
        if st.session_state.ai_use_cases:
            st.subheader("AI Use Cases")
            st.write(st.session_state.ai_use_cases)
            
        competitor = st.text_input("Enter Competitor Name")
        if st.button("Analyze Competitor AI Strategies"):
            progress_bar.progress(85)
            st.session_state.competitor_analysis = get_competitor_ai_strategies(competitor)
            progress_bar.progress(90)
        
        if st.session_state.competitor_analysis:
            st.subheader("Competitor AI Strategies")
            st.write(st.session_state.competitor_analysis)
        
        # Phase 3: AI Strategy and Report Generation
        if st.button("Generate AI Strategy"):
            progress_bar.progress(95)
            st.session_state.ai_strategy = generate_ai_strategy(
                st.session_state.company_data, st.session_state.industry_trends,
                st.session_state.ai_use_cases, st.session_state.competitor_analysis)
            progress_bar.progress(100)
        
        if st.session_state.ai_strategy:
            st.subheader("AI Strategy")
            st.write(st.session_state.ai_strategy)
            
        if st.button("Suggest AI Integration Plan"):
            st.session_state.ai_integration = suggest_ai_integration(
                st.session_state.company_data, st.session_state.ai_strategy)
        
        if st.session_state.ai_integration:
            st.subheader("AI Integration Plan")
            st.write(st.session_state.ai_integration)
            
        if st.button("Identify Revenue Growth Opportunities"):
            st.session_state.revenue_opportunities = identify_revenue_opportunities(
                st.session_state.company_data, st.session_state.ai_strategy)
        
        if st.session_state.revenue_opportunities:
            st.subheader("Revenue Growth Opportunities")
            st.write(st.session_state.revenue_opportunities)
            
        if st.button("Generate Final Report"):
            report_filename = generate_report(
                company_name, st.session_state.ai_strategy, st.session_state.ai_integration, 
                st.session_state.revenue_opportunities)
            st.success(f"Report Generated: {report_filename}")
        
    st.markdown("---")
    st.markdown("**Developed by [Aditya Ghadge](https://www.linkedin.com/in/aditya-ghadge-a82b30240/) for Giant Analytics**")

if __name__ == "__main__":
    main()