FastAPI + React + Gemini 1.5 Flash

Your messy folder,
organized in seconds.

Point it at any directory. The AI reads file names, extensions, and content snippets — then moves everything into semantic folders like MBA Coursework, Invoices, or Code Projects. No rules to configure.

ai-file-organizer — live log
$ uvicorn main:app --reload
INFO: Application startup complete.

Validating configuration...
Scanning target directory: C:\Users\Akshay\Downloads
Found 147 files across 12 extensions

Extracting content snippets...
budget_q1_2025.xlsx → Financials/
ITEC617_case_study.pdf → MBA Coursework/
react_hooks_notes.md → Code Projects/
passport_scan.jpg → Identity Documents/
zoom_recording_april.mp4 → Recordings/
...

Organized 147 files into 9 categories
0 conflicts, 0 errors — complete in 4.2s
1
Scan the directory
FastAPI backend walks the target folder and collects all file paths, sizes, and extensions.
2
Extract content snippets
For text files, CSVs, markdown, code, and PDFs — reads the first 500 characters to give the AI real context beyond the filename.
3
Gemini categorizes each file
Gemini 1.5 Flash receives the filename, extension, and content snippet. It decides the most logical semantic folder for each file based on actual meaning.
4
Files are moved, logs stream live
The React frontend receives a real-time Server-Sent Events stream. Each file move appears in the log as it happens — no page refresh needed.
Context-aware categorization
Reads actual file content — not just filenames — so notes.txt about taxes goes to Financials, not a generic Notes folder.
PDF + text extraction
Uses pypdf for PDFs and raw reads for code, markdown, CSV, and JSON. Handles 7+ file types without additional dependencies.
Real-time log stream
FastAPI Server-Sent Events push each file move to the React UI as it happens. No polling, no wait.
Decoupled architecture
Backend and frontend are fully independent — swap the React UI or replace the AI model without touching the other layer.
Python 3.x FastAPI Google Gemini 1.5 Flash React Vite Tailwind CSS Lucide React pypdf Server-Sent Events python-dotenv

Requires Python 3.8+, Node.js 18+, and a Gemini API key.

# Clone and set up backend
git clone https://github.com/akbknight/Ai-automation.git
cd Ai-automation/backend
python -m venv .venv && .venv\Scripts\activate
pip install -r requirements.txt

# Add your Gemini API key
echo GEMINI_API_KEY=your_key_here > .env
uvicorn main:app --reload
# In a second terminal — start the frontend
cd ../frontend
npm install && npm run dev

# Open http://localhost:5173 and point it at any directory