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()