Coder Social home page Coder Social logo

staberas / ai-renamer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ozgrozer/ai-renamer

0.0 0.0 0.0 3.4 MB

A Node.js CLI that uses Ollama models (Llama, Gemma, Llava etc.) to intelligently rename files and images in a specified directory

Home Page: https://x.com/ozgrozer/status/1810338137639452867

License: GNU General Public License v3.0

JavaScript 100.00%

ai-renamer's Introduction

ai-renamer

A Node.js CLI that uses Ollama and LM Studio models (Llava, Gemma, Llama etc.) to intelligently rename files by their contents

npm license

Preview

Rename images

ai-renamer-images-1080p.mp4

Rename files

ai-renamer-1080p.mov

Usage

You need to have Ollama or LM Studio and at least one LLM (Llava, Gemma, Llama etc.) installed on your system

Run with NPX

npx ai-renamer /path

Run with NPM

# Install it globally
npm install -g ai-renamer

# Run it
ai-renamer /path

Ollama Usage

Ollama is the default provider so you don't have to do anything. You can just run npx ai-renamer /images. At the first launch it will try to auto-select the Llava model but if it couldn't do that you can specify the model.

npx ai-renamer /path --provider=ollama --model=llava:13b

LM Studio Usage

You need to set the provider as lm-studio and it will auto-select the loaded model in LM Studio.

npx ai-renamer /path --provider=lm-studio

OpenAI Usage

You need to set the provider as openai and the api-key with your API key and it will auto-select the gpt-4o model. But you can assign any model with --model flag.

npx ai-renamer /path --provider=openai --api-key=OPENAI_API_KEY

Custom Ports

If you're using a different port in Ollama or LM Studio you could simply specify the base URLs.

npx ai-renamer /path --provider=ollama --base-url=http://127.0.0.1:11434
npx ai-renamer /path --provider=lm-studio --base-url=http://127.0.0.1:1234

Params

The values of the flags will be saved to your disk when you use them. You can find the config file at ~/ai-renamer.json. If you're using a Mac it's /Users/your-user-name/ai-renamer.json. Also when you set a flag you don't have to use them again. The script gets the values from this config file.

npx ai-renamer --help
Options:
  -h, --help                    Show help                              [boolean]
      --version                 Show version number                    [boolean]
  -p, --provider                Set the provider (e.g. ollama, openai,
                                lm-studio)                              [string]
  -a, --api-key                 Set the API key if you're using openai as
                                provider                                [string]
  -u, --base-url                Set the API base URL (e.g.
                                http://127.0.0.1:11434 for ollama)      [string]
  -m, --model                   Set the model to use (e.g. gemma2, llama3,
                                gpt-4o)                                 [string]
  -c, --case                    Set the case style (e.g. camelCase, pascalCase,
                                snakeCase, kebabCase)                   [string]
  -x, --chars                   Set the maximum number of characters in the new
                                filename (e.g. 25)                      [number]
  -l, --language                Set the output language (e.g. English, Turkish)
                                                                        [string]
  -s, --include-subdirectories  Include files in subdirectories when processing
                                (e.g: true, false)                      [string]

ai-renamer uses change-case library for case styling

# value: result
camelCase: twoWords
capitalCase: Two Words
constantCase: TWO_WORDS
dotCase: two.words
kebabCase: two-words
noCase: two words
pascalCase: TwoWords
pascalSnakeCase: Two_Words
pathCase: two/words
sentenceCase: Two words
snakeCase: two_words
trainCase: Two-Words

Contribution

Feel free to contribute. Open a new issue, or make a pull request.

License

GPL-3.0

ai-renamer's People

Contributors

ozgrozer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.