InsightCraft AI: Business Analysis System InsightCraft AI is a cutting-edge business analyst tool that processes Excel and PDF files, answers user questions, and delivers human-level insights with risks, opportunities, trends, and actionable decisions. Built with a professional Streamlit UI, it uses OpenRouter's free-tier model (LLaMA 3.1 8B Instruct) for smart analysis, making it ideal for executives and analysts. Features
File Upload: Supports Excel (.xlsx) and PDF (.pdf) files. Data Extraction: Extracts data using Pandas (Excel) and PyMuPDF (PDF). Question-Based Analysis: Answers business questions with structured insights (Risks, Opportunities, Trends, Decisions). Report Generation: Provides a downloadable TXT report with analysis details. Modern UI: Streamlit-based interface with Tailwind CSS.
Installation
Clone the repository: git clone https://github.com/yourusername/insightcraft.git cd insightcraft
Install dependencies: pip install streamlit pandas PyMuPDF requests python-dotenv
Set up your OpenRouter API key in a .env file in the project root: OPENROUTER_API_KEY=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
Run the app: streamlit run app.py
Usage
Open the app in your browser (default: http://localhost:8501). In the sidebar, upload Excel and/or PDF files and select the OpenRouter model. Enter a business question (e.g., 'Which product is losing sales?'). Click "Analyze" to process files and get insights. View the analysis (Risks, Opportunities, Trends, Decisions). Download the report as a TXT file.
Troubleshooting
401 Unauthorized Error: Ensure the .env file is in the insightcraft/ directory and contains the correct API key. Verify your API key at OpenRouter's dashboard. Run pip install python-dotenv to load the .env file. Restart the app after updating the .env file.
Rate Limits: The free tier has strict rate limits. Wait a few minutes if you hit limits. Check OpenRouter's status page for issues.
File Processing Errors: Ensure Excel files are valid .xlsx and PDFs are not encrypted. Check terminal logs for details.
File Structure
app.py: Main Streamlit application with the UI and core logic. data_processor.py: File extraction and AI analysis logic. models_config.py: OpenRouter model configurations and client initialization. README.md: Project documentation.
Future Enhancements
Add image processing with a vision model (e.g., for product images). Support chart generation for visual insights. Enhance data summarization with advanced preprocessing.
Contributing Contributions are welcome! Please open an issue or submit a pull request on GitHub. Ensure your code follows PEP 8 and includes tests where applicable. License MIT License. See LICENSE for details.