CoolFace
Apppublic

vikesh99/ai-file-converter

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

๐Ÿค– AI File Converter

A ChatGPT-like file conversion web app that runs 100% locally. Upload a file, describe what you want in plain English, and download the converted result.

Privacy-first: No files are ever sent to any external API or cloud service.

โœจ Features

  • โ€”๐Ÿง  AI intent detection โ€” TinyLlama via Ollama understands natural language commands
  • โ€”๐Ÿ“„ Multi-format support โ€” PDF, DOCX, PPTX, XLSX, TXT, CSV, ODT, RTF
  • โ€”๐Ÿ”’ 100% local โ€” runs entirely on your machine
  • โ€”๐Ÿ’ฌ Chat UI โ€” ChatGPT-like interface with drag & drop upload
  • โ€”๐Ÿงน Auto cleanup โ€” uploaded and converted files deleted after download

๐Ÿ“ฆ Supported Conversions

InputOutputs
PDFDOCX, TXT, PPTX
DOCX / DOCPDF, TXT, ODT
PPTX / PPTPDF
XLSX / XLSPDF, CSV
TXTPDF, DOCX
RTFPDF
ODTPDF

โš™๏ธ System Requirements

ToolVersionStatus
Python3.10+Required
Ollama0.23+โœ… Installed
TinyLlamalatestโœ… Pulled
LibreOffice7.x+โœ… Installed at C:\Program Files\LibreOffice
Pandoc3.x+โœ… Installed

๐Ÿš€ Quick Start

1. Create & activate virtual environment

powershell
cd ai-file-converter
python -m venv venv
venv\Scripts\activate

2. Install Python dependencies

powershell
pip install -r backend/requirements.txt

3. Start Ollama (if not already running)

powershell
ollama serve

4. Start the FastAPI backend

powershell
cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000

5. Open the frontend

Open frontend/index.html in your browser, or serve it:

powershell
cd frontend
python -m http.server 3000
# Then open http://localhost:3000

๐Ÿ—‚๏ธ Project Structure

ai-file-converter/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py              # FastAPI app (endpoints)
โ”‚   โ”œโ”€โ”€ intent_detector.py   # TinyLlama + rule-based intent parser
โ”‚   โ”œโ”€โ”€ converter.py         # Conversion routing engine
โ”‚   โ”œโ”€โ”€ utils.py             # File helpers
โ”‚   โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ index.html           # Chat UI
โ”‚   โ”œโ”€โ”€ app.js               # Frontend logic
โ”‚   โ””โ”€โ”€ style.css            # Premium dark styling
โ”œโ”€โ”€ uploads/                 # Temp (auto-cleaned)
โ”œโ”€โ”€ outputs/                 # Temp (auto-cleaned)
โ”œโ”€โ”€ .env                     # Config (paths, limits)
โ””โ”€โ”€ .gitignore

๐Ÿ’ฌ Example Commands

You typeWhat happens
convert this to pdfโ†’ PDF output
i need a docx versionโ†’ DOCX output
give me a text fileโ†’ TXT output
turn it into a spreadsheetโ†’ XLSX output
make it a presentationโ†’ PPTX output

โš ๏ธ Known Limitations

  • โ€”PDF โ†’ PPTX may lose complex formatting
  • โ€”Scanned PDFs (image-only) cannot be converted to TXT (no OCR)
  • โ€”LibreOffice conversions may take 2โ€“5 seconds

๐Ÿ” Privacy

  • โ€”No files sent to external APIs (unless configured to use cloud LLMs)
  • โ€”All processing is local
  • โ€”Files auto-deleted after each conversion
  • โ€”No file contents are logged

โ˜๏ธ Production Hosting (Under 1 GB)

To host this application publicly on cloud platforms (e.g., Render, Railway, DigitalOcean, AWS) with a minimal storage footprint:

  1. 1.Enable Cloud LLM API (Reduces size by 600MB+ & RAM by 1GB+) Add your API key to the environment variables (.env file or cloud dashboard):
  2. 2.GEMINI_API_KEY: Get a free key from Google AI Studio.
  3. 3.GROQ_API_KEY: Get a free key from Groq Console.

If either key is set, the backend will bypass the local Ollama process and use the cloud API for extremely fast (0.1s) and free intent detection.

  1. 1.Docker Deployment Use the included Dockerfile to build and deploy the container. It is optimized to install only headless, GUI-less packages for LibreOffice and Pandoc, keeping the image size around ~500 MB total.

To run locally or build using Docker:

bash
   docker build -t ai-file-converter .
   docker run -p 8000:8000 --env GEMINI_API_KEY="your_api_key" ai-file-converter

Built with FastAPI ยท TinyLlama/Gemini ยท LibreOffice ยท Pandoc ยท pdf2docx