Business - raghavkhandelwal12/Artificial-Intelligence GitHub Wiki

AI-Powered Monthly Report Generation

Project Overview

This project utilizes AI to automate Monthly Report Generation in Excel format. Using an open-source AI model as an alternative to LLaMA 3.1-8B, it extracts key insights from data, generates structured reports, and formats them efficiently.

Features

  • Automated Data Analysis: Extracts insights from raw data.
  • Excel Report Generation: Creates structured, formatted reports.
  • Customizable Report Templates: Users can modify layouts as needed.
  • Open-Source AI Model: Free and efficient alternative to LLaMA 3.1-8B.

Alternative to LLaMA 3.1-8B

Since LLaMA 3.1-8B is not fully open-source, we will use:

  1. Mistral-7B → [Hugging Face Model](https://huggingface.co/mistralai/Mistral-7B)
  2. Falcon-7B → [Hugging Face Model](https://huggingface.co/tiiuae/falcon-7b)

Both models are optimized for text-based analysis and available for free.

Python Version

  • Python 3.10+ (Recommended for AI and data processing libraries)

Dependencies

Install all required libraries with:

pip install pandas openpyxl torch transformers datasets

Save dependencies in a file:

pip freeze > requirements.txt

Folder Structure

AI_Monthly_Reports/
│── data/
│   ├── raw_data.xlsx        # Input raw data files
│   ├── processed_data.xlsx  # Cleaned & structured data
│
│── models/
│   ├── mistral_model/       # AI model files
│
│── reports/
│   ├── monthly_report.xlsx  # Generated Excel reports
│
│── src/
│   ├── data_processing.py   # Data cleaning & preprocessing
│   ├── report_generator.py  # Report creation logic
│   ├── model_inference.py   # AI model for insights
│
│── main.py                  # Main script to run the pipeline
│── requirements.txt          # Required dependencies
│── README.md                 # Documentation

Implementation Steps

1. Data Processing (src/data_processing.py)

Cleans raw Excel data:

import pandas as pd

def clean_data(input_file, output_file):
    df = pd.read_excel(input_file)
    df.dropna(inplace=True)  # Remove missing values
    df.to_excel(output_file, index=False)
    return df

2. Model Inference (src/model_inference.py)

Loads the AI model and extracts key insights:

from transformers import AutoModelForCausalLM, AutoTokenizer

def load_model():
    model_name = "mistralai/Mistral-7B"
    tokenizer = AutoTokenizer.from_pretrained(model_name)
    model = AutoModelForCausalLM.from_pretrained(model_name)
    return model, tokenizer

3. Report Generation (src/report_generator.py)

Generates Excel reports:

import openpyxl

def create_excel_report(data, output_file):
    workbook = openpyxl.Workbook()
    sheet = workbook.active
    sheet.title = "Monthly Report"
    
    for row in data.itertuples(index=False):
        sheet.append(row)
    
    workbook.save(output_file)

4. Running the Full Pipeline (main.py)

from src.data_processing import clean_data
from src.report_generator import create_excel_report

data = clean_data("data/raw_data.xlsx", "data/processed_data.xlsx")
create_excel_report(data, "reports/monthly_report.xlsx")

Running the Project

Execute the script:

python main.py

Next Steps

  • Enhance AI for Data Insights: NLP-based summarization.
  • Improve Report Visualizations: Graphs & charts in Excel.
  • Automate Email Report Delivery: Send reports automatically.

With this structured approach, you'll successfully complete and deliver the project to your client with confidence.