Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/bmachek/lrc-gemini
Browse files Browse the repository at this point in the history
  • Loading branch information
bmachek committed Sep 28, 2024
2 parents b47a19a + 45580aa commit 8ff73d1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Bastian Machek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

A Lightroom Classic to fill keywords, image title and caption by using Google Gemini (gemini-1.5-flash/pro) or ChatGPT (gpt-4o)

# Your photos will be sent to Google or OpenAI for this! Do not use the plugin, if you don't agree with this!
## Privacy / Disclaimer
### Your photos will be sent to Google or OpenAI for analysis! Do not use the plugin, if you don't agree with this.

## Usage
* Install plugin using Lightroom addon module manager.
Expand All @@ -19,10 +20,29 @@ A Lightroom Classic to fill keywords, image title and caption by using Google Ge
* If enabled review before save for title and/or caption and the field is already filled with data, a review dialog will show up.
* Wait it to fill your keywords, caption or title as selected.

## Which model should I use:
* **gemini-1.5-pro**: If you want the best results, and are willing to setup billing.
* **gemini-1.5-flash**: If you want very good results for free.
* **ChatGPT**: IMHO it doesn't make sense to use this model for now, as the results turn out to be very generic.

## Phrases
You can adapt the phrases sent to Google / OpenAI to your likings in the module manager dialog.

### A few examples:
### Title
* Generate an image title using the location
* Generate an image title using the recognized buildings
### Caption
* Generate an image caption including recognized location, buildings and persons.
### Keywords
* The keywords phrase cannot be adapted yet, due to the necessary special format of the phrase.


## Google rate limits
The free version of gemini-flash-1.5 is limited to 1500 prompts per day.
There's also a soft limit on how many requests per minute are allowed, which can of course be circumvented by waiting for a few seconds, when a request is denied.
The plugin waits for 5 seconds after each denied prompt, if the error 'RESOURCE_EXHAUSTED' persists for 10 of these wait loops, it assumes that the daily limit has been hit, and stops the process with an error message.
The plugin waits for 5 seconds after each denied prompt, if the error 'RESOURCE_EXHAUSTED' persists for 10 of these wait loops, it assumes that the daily limit has been hit, and stops the process with an error message.
### You can of course always setup billing at Google to get rid of these limits!

## Notes
* Google AI has safety features, so some content is blocked. Especially:
Expand All @@ -40,4 +60,6 @@ The plugin waits for 5 seconds after each denied prompt, if the error 'RESOURCE_
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=2LL4K9LN5CFA6)

## Credits
@gesteves for [his plugin](https://github.com/gesteves/lightroom-alt-text-plugin), which gave me the idea for this one, and on which the source code is based on.
* @gesteves for [his plugin](https://github.com/gesteves/lightroom-alt-text-plugin), which gave me the idea for this one, and on which the source code is based on.
* @kikito for [inspect.lua](http://github.com/kikito/inspect.lua)
* Jeffrey Friedl for [JSON.lua](http://regex.info/blog/lua/json)

0 comments on commit 8ff73d1

Please sign in to comment.