Skip to content

Repository files navigation

本地文件整理器:完全在您的设备上运行的 AI 文件管理,隐私有保障

厌倦了数字混乱?被散落在电脑各处的杂乱文件压得喘不过气?让 AI 来帮您!本地文件整理器是您的个人整理助手,使用尖端 AI 技术为您的文件混乱带来秩序 - 同时完全尊重您的隐私。

工作原理 💡

整理前:

/home/user/messy_documents/
├── IMG_20230515_140322.jpg
├── IMG_20230516_083045.jpg
├── IMG_20230517_192130.jpg
├── budget_2023.xlsx
├── meeting_notes_05152023.txt
├── project_proposal_draft.docx
├── random_thoughts.txt
├── recipe_chocolate_cake.pdf
├── scan0001.pdf
├── vacation_itinerary.docx
└── work_presentation.pptx

0 个目录,11 个文件

整理后:

/home/user/organized_documents/
├── Financial
│   └── 2023_Budget_Spreadsheet.xlsx
├── Food_and_Recipes
│   └── Chocolate_Cake_Recipe.pdf
├── Meetings_and_Notes
│   └── Team_Meeting_Notes_May_15_2023.txt
├── Personal
│   └── Random_Thoughts_and_Ideas.txt
├── Photos
│   ├── Cityscape_Sunset_May_17_2023.jpg
│   ├── Morning_Coffee_Shop_May_16_2023.jpg
│   └── Office_Team_Lunch_May_15_2023.jpg
├── Travel
│   └── Summer_Vacation_Itinerary_2023.docx
└── Work
    ├── Project_X_Proposal_Draft.docx
    ├── Quarterly_Sales_Report.pdf
    └── Marketing_Strategy_Presentation.pptx

7 个目录,11 个文件

更新日志 🚀

[2024/09] v0.0.2:

  • Nexa GalleryNexa SDK Cookbook 收录!
  • 试运行模式:在提交更改前检查分类结果
  • 静默模式:将所有日志保存到 txt 文件以实现更安静的操作
  • 新增文件支持:.md.excel.ppt.csv
  • 三种分类选项:按内容、按日期和按类型
  • 默认文本模型现在是 Llama3.2 3B
  • 改进的命令行交互体验
  • 为文件分析添加了实时进度条

请通过删除原项目文件夹并重新安装依赖项来更新项目。参考安装指南的第 4 步。

开发路线图 📅

  • 副驾驶模式:与 AI 聊天告诉它您想如何分类文件(例如:读取并重命名所有 PDF)
  • 通过命令行更改模型
  • 电子书格式支持
  • 音频文件支持
  • 视频文件支持
  • 实施 Johnny Decimal 等最佳实践
  • 检查文件重复
  • Dockerfile 以便更轻松地安装
  • Nexa 的人员正在帮助我制作 macOS、Linux 和 Windows 的可执行文件

功能说明 🔍

这个智能文件整理器利用先进 AI 模型的强大功能,包括语言模型(LMs)和视觉语言模型(VLMs),通过以下方式自动化文件整理过程:

  • 扫描指定的输入目录中的文件

  • 内容理解:

    • 文本分析:使用 Llama3.2 3B 分析和总结基于文本的内容,生成相关描述和文件名。
    • 视觉内容分析:使用基于 Vicuna-7B 的 LLaVA-v1.6 解读图像等视觉文件,提供上下文感知的分类和描述。
  • 理解您文件的内容(文本、图像等),生成相关描述、文件夹名称和文件名

  • 基于生成的元数据将文件整理到新的目录结构中

最棒的部分?所有 AI 处理都使用 Nexa SDK 100% 在您的本地设备上进行。无需互联网连接,数据不会离开您的计算机,也不需要 AI API - 让您的文件完全私密和安全。

支持的文件类型 📁

  • 图像: .png.jpg.jpeg.gif.bmp
  • 文本文件: .txt.docx.md
  • 电子表格: .xlsx.csv
  • 演示文稿: .ppt.pptx
  • PDF: .pdf

系统要求 💻

  • 操作系统: 兼容 Windows、macOS 和 Linux
  • Python 版本: Python 3.12
  • Conda: 已安装 Anaconda 或 Miniconda
  • Git: 用于克隆仓库(或者您可以将代码下载为 ZIP 文件)

安装步骤 🛠

对于 SDK 安装和模型相关问题,请在这里发帖。

1. 安装 Python

在安装本地文件整理器之前,请确保您的系统已安装 Python。我们建议使用 Python 3.12 或更高版本。

您可以从官方网站下载 Python。

按照您操作系统的安装说明进行操作。

2. 克隆仓库

使用 Git 将此仓库克隆到本地机器:

git clone https://github.com/QiuYannnn/Local-File-Organizer.git

或者将仓库下载为 ZIP 文件并解压到您想要的位置。

3. 设置 Python 环境

创建一个名为 local_file_organizer 的新 Conda 环境,使用 Python 3.12:

conda create --name local_file_organizer python=3.12

激活环境:

conda activate local_file_organizer

4. 安装 Nexa SDK

CPU 安装

要安装 CPU 版本的 Nexa SDK,运行:

pip install nexaai --prefer-binary --index-url https://nexaai.github.io/nexa-sdk/whl/cpu --extra-index-url https://pypi.org/simple --no-cache-dir

GPU 安装(Metal - macOS)

对于支持 Metal(macOS)的 GPU 版本,运行:

CMAKE_ARGS="-DGGML_METAL=ON -DSD_METAL=ON" pip install nexaai --prefer-binary --index-url https://nexaai.github.io/nexa-sdk/whl/metal --extra-index-url https://pypi.org/simple --no-cache-dir

有关 CUDAAMD GPU 支持的 Nexa SDK 详细安装说明,请参阅主 README 中的安装部分

5. 安装依赖项

  1. 确保您在项目目录中:

    cd path/to/Local-File-Organizer

    path/to/Local-File-Organizer 替换为您克隆或解压项目的实际路径。

  2. 安装所需的依赖项:

    pip install -r requirements.txt

注意: 如果您在安装任何包时遇到问题,请单独安装它们:

pip install nexa Pillow pytesseract PyMuPDF python-docx

在激活环境并安装依赖项后,使用以下命令运行脚本:

6. 运行脚本🎉

python main.py

注意事项

  • SDK 模型:

    • 该脚本使用 NexaVLMInferenceNexaTextInference 模型使用说明
    • 确保您可以访问这些模型并且它们已正确设置。
    • 您可能需要下载模型文件或配置路径。
  • 依赖项:

    • pytesseract: 需要在您的系统上安装 Tesseract OCR。
    • PyMuPDF (fitz): 用于读取 PDF。
  • 处理时间:

    • 处理时间取决于文件的数量和大小。
    • 该脚本使用多进程来提高性能。
  • 自定义提示词:

    • 您可以在 data_processing.py 中调整提示词以更改元数据的生成方式。

许可证

本项目采用 MIT 许可证和 Apache 2.0 许可证双重许可。您可以选择您希望用于本项目的许可证。

Local File Organizer: AI File Management Run Entirely on Your Device, Privacy Assured

Tired of digital clutter? Overwhelmed by disorganized files scattered across your computer? Let AI do the heavy lifting! The Local File Organizer is your personal organizing assistant, using cutting-edge AI to bring order to your file chaos - all while respecting your privacy.

How It Works 💡

Before:

/home/user/messy_documents/
├── IMG_20230515_140322.jpg
├── IMG_20230516_083045.jpg
├── IMG_20230517_192130.jpg
├── budget_2023.xlsx
├── meeting_notes_05152023.txt
├── project_proposal_draft.docx
├── random_thoughts.txt
├── recipe_chocolate_cake.pdf
├── scan0001.pdf
├── vacation_itinerary.docx
└── work_presentation.pptx

0 directories, 11 files

After:

/home/user/organized_documents/
├── Financial
│   └── 2023_Budget_Spreadsheet.xlsx
├── Food_and_Recipes
│   └── Chocolate_Cake_Recipe.pdf
├── Meetings_and_Notes
│   └── Team_Meeting_Notes_May_15_2023.txt
├── Personal
│   └── Random_Thoughts_and_Ideas.txt
├── Photos
│   ├── Cityscape_Sunset_May_17_2023.jpg
│   ├── Morning_Coffee_Shop_May_16_2023.jpg
│   └── Office_Team_Lunch_May_15_2023.jpg
├── Travel
│   └── Summer_Vacation_Itinerary_2023.docx
└── Work
    ├── Project_X_Proposal_Draft.docx
    ├── Quarterly_Sales_Report.pdf
    └── Marketing_Strategy_Presentation.pptx

7 directories, 11 files

Updates 🚀

[2024/09] v0.0.2:

  • Featured by Nexa Gallery and Nexa SDK Cookbook!
  • Dry Run Mode: check sorting results before committing changes
  • Silent Mode: save all logs to a txt file for quieter operation
  • Added file support: .md, .excel, .ppt, and .csv
  • Three sorting options: by content, by date, and by type
  • The default text model is now Llama3.2 3B
  • Improved CLI interaction experience
  • Added real-time progress bar for file analysis

Please update the project by deleting the original project folder and reinstalling the requirements. Refer to the installation guide from Step 4.

Roadmap 📅

  • Copilot Mode: chat with AI to tell AI how you want to sort the file (ie. read and rename all the PDFs)
  • Change models with CLI
  • ebook format support
  • audio file support
  • video file support
  • Implement best practices like Johnny Decimal
  • Check file duplication
  • Dockerfile for easier installation
  • People from Nexa is helping me to make executables for macOS, Linux and Windows

What It Does 🔍

This intelligent file organizer harnesses the power of advanced AI models, including language models (LMs) and vision-language models (VLMs), to automate the process of organizing files by:

  • Scanning a specified input directory for files.

  • Content Understanding:

    • Textual Analysis: Uses the Llama3.2 3B to analyze and summarize text-based content, generating relevant descriptions and filenames.
    • Visual Content Analysis: Uses the LLaVA-v1.6 , based on Vicuna-7B, to interpret visual files such as images, providing context-aware categorization and descriptions.
  • Understanding the content of your files (text, images, and more) to generate relevant descriptions, folder names, and filenames.

  • Organizing the files into a new directory structure based on the generated metadata.

The best part? All AI processing happens 100% on your local device using the Nexa SDK. No internet connection required, no data leaves your computer, and no AI API is needed - keeping your files completely private and secure.

Supported File Types 📁

  • Images: .png, .jpg, .jpeg, .gif, .bmp
  • Text Files: .txt, .docx, .md
  • Spreadsheets: .xlsx, .csv
  • Presentations: .ppt, .pptx
  • PDFs: .pdf

Prerequisites 💻

  • Operating System: Compatible with Windows, macOS, and Linux.
  • Python Version: Python 3.12
  • Conda: Anaconda or Miniconda installed.
  • Git: For cloning the repository (or you can download the code as a ZIP file).

Installation 🛠

For SDK installation and model-related issues, please post on here.

1. Install Python

Before installing the Local File Organizer, make sure you have Python installed on your system. We recommend using Python 3.12 or later.

You can download Python from the official website.

Follow the installation instructions for your operating system.

2. Clone the Repository

Clone this repository to your local machine using Git:

git clone https://github.com/QiuYannnn/Local-File-Organizer.git

Or download the repository as a ZIP file and extract it to your desired location.

3. Set Up the Python Environment

Create a new Conda environment named local_file_organizer with Python 3.12:

conda create --name local_file_organizer python=3.12

Activate the environment:

conda activate local_file_organizer

4. Install Nexa SDK ️

CPU Installation

To install the CPU version of Nexa SDK, run:

pip install nexaai --prefer-binary --index-url https://nexaai.github.io/nexa-sdk/whl/cpu --extra-index-url https://pypi.org/simple --no-cache-dir

GPU Installation (Metal - macOS)

For the GPU version supporting Metal (macOS), run:

CMAKE_ARGS="-DGGML_METAL=ON -DSD_METAL=ON" pip install nexaai --prefer-binary --index-url https://nexaai.github.io/nexa-sdk/whl/metal --extra-index-url https://pypi.org/simple --no-cache-dir

For detailed installation instructions of Nexa SDK for CUDA and AMD GPU support, please refer to the Installation section in the main README.

5. Install Dependencies

  1. Ensure you are in the project directory:

    cd path/to/Local-File-Organizer

    Replace path/to/Local-File-Organizer with the actual path where you cloned or extracted the project.

  2. Install the required dependencies:

    pip install -r requirements.txt

Note: If you encounter issues with any packages, install them individually:

pip install nexa Pillow pytesseract PyMuPDF python-docx

With the environment activated and dependencies installed, run the script using:

6. Running the Script🎉

python main.py

Notes

  • SDK Models:

    • The script uses NexaVLMInference and NexaTextInference models usage.
    • Ensure you have access to these models and they are correctly set up.
    • You may need to download model files or configure paths.
  • Dependencies:

    • pytesseract: Requires Tesseract OCR installed on your system.
    • PyMuPDF (fitz): Used for reading PDFs.
  • Processing Time:

    • Processing may take time depending on the number and size of files.
    • The script uses multiprocessing to improve performance.
  • Customizing Prompts:

    • You can adjust prompts in data_processing.py to change how metadata is generated.

License

This project is dual-licensed under the MIT License and Apache 2.0 License. You may choose which license you prefer to use for this project.

Releases

Packages

Contributors

Languages