AI-powered ESG (Environmental, Social, Governance) analysis and reporting platform using a fine-tuned language model.
- π€ AI-Powered Analysis - ESG-specialized language model (fingesg4)
- π PDF Upload - Analyze annual reports and financial documents
- π¬ Chat Interface - Multi-turn conversations with context awareness
- π Secure Authentication - JWT-based login with demo mode
- πΎ Persistent Storage - SQLite database for conversation history
- β‘ Fast Inference - 150+ tokens/sec using LM Studio
- Python 3.10+
- Node.js 18+
- LM Studio (for AI model serving)
- Git
git clone <repository-url>
cd ai_backend# Install Python dependencies
pip install -r requirements.txt
# Run backend server
python main.pyBackend will start on http://localhost:8080
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run devFrontend will start on http://localhost:5173
- Download & Install LM Studio
- Download Model: Search for "Qwen 2.5-1.5B-Instruct" in LM Studio
- Load Model in Chat tab
- Start Local Server on port 1234
Step 1: Convert fingesg4 Model to GGUF
# Install dependencies
pip install transformers peft accelerate
# Run merge script (creates fingesg4_merged folder)
python merge_fingesg4.py
# Clone llama.cpp for conversion
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Convert to GGUF format
python convert_hf_to_gguf.py ../fingesg4_merged --outtype f16 --outfile fingesg4.ggufNote: The
merge_fingesg4.pyscript downloads the fingesg4 adapter from HuggingFace and merges it with Qwen 2.5-1.5B base model.
Step 2: Import to LM Studio (CRITICAL: Folder Structure)
LM Studio requires a double-nested folder structure:
C:\Users\<YourName>\.lmstudio\models\
βββ fingesg4\ # Parent folder
βββ fingesg4\ # Child folder (same name!)
βββ fingesg4.gguf # Your model file
Manual Setup:
# Navigate to LM Studio models directory
cd "C:\Users\<YourName>\.lmstudio\models"
# Create parent folder
mkdir fingesg4
# Create child folder (same name)
mkdir fingesg4\fingesg4
# Copy your GGUF file into the nested folder
copy "C:\path\to\llama.cpp\fingesg4.gguf" "fingesg4\fingesg4\fingesg4.gguf"Step 3: Load in LM Studio
- Restart LM Studio completely (close and reopen)
- Go to "My Models" tab - you should now see
fingesg4 - Click "Chat" tab β Select
fingesg4from dropdown - Go to "Local Server" tab β Click "Start Server" (port 1234)
- Verify: Status should show "Running" with model name
fingesg4
Troubleshooting: If model doesn't appear, verify the folder structure is exactly:
models\fingesg4\fingesg4\fingesg4.gguf
- React 18 + TypeScript
- Vite - Build tool
- Tailwind CSS - Styling
- shadcn/ui - Component library
- FastAPI - Web framework
- SQLAlchemy - ORM
- SQLite - Database
- Pydantic - Validation
- LM Studio - Model serving
- fingesg4 - ESG-specialized model
- Qwen 2.5-1.5B - Base model
See TECH_STACK.md for complete details.
ai_backend/
βββ app/ # Backend (FastAPI)
β βββ api.py # API routes
β βββ models.py # Database models
β βββ schemas.py # Pydantic schemas
β βββ crud.py # Database operations
β βββ auth.py # Authentication
β βββ ml_engine_lmstudio.py # LM Studio integration
βββ frontend/ # Frontend (React)
β βββ src/
β β βββ components/ # React components
β β βββ contexts/ # State management
β βββ package.json
βββ main.py # Backend entry point
βββ requirements.txt # Python dependencies
βββ README.md
Create .env file in root:
SECRET_KEY=your-secret-key-here
DATABASE_URL=sqlite:///./ai_backend.db- Email: demo@example.com
- Password: demo123
| Metric | Value |
|---|---|
| Inference Speed | 150+ tokens/sec |
| Response Time | 2-3 seconds |
| Memory Usage | ~2GB VRAM |
| Model Size | 900MB (quantized) |
- ESG report analysis
- Sustainability reporting
- Financial document review
- Compliance checking
- Corporate governance analysis
- JWT token authentication
- HTTPOnly cookies
- Password hashing (bcrypt)
- Parameterized SQL queries
- CORS configuration
Once the backend is running, visit:
- Swagger UI: http://localhost:8080/docs
- ReDoc: http://localhost:8080/redoc
Contributions welcome! Please follow these steps:
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is licensed under the MIT License.
- Qwen Team - Base language model
- LM Studio - Optimized inference engine
- FastAPI - Modern Python web framework
- shadcn/ui - Beautiful component library
For questions or support, please open an issue on GitHub.
Built with β€οΈ for ESG Analysis
Making sustainability reporting accessible and efficient