update cog doc

This commit is contained in:
Victor Hall 2024-03-13 18:31:52 -04:00
parent 1cf110c6a5
commit 776edcf9d9
1 changed files with 5 additions and 2 deletions

View File

@ -87,7 +87,7 @@ Write a description.
```
This is very useful if you can organize your data into folders that are meaningful to the captioning task, either manually, or with a classifier.
* `title_and_tags_from_metadata_json` Adds the title and tags from a metadata.json file in the same folder as the image to the prompt. This is useful if you have a metadata.json file in each folder with the images. The metadata.json file should look like this:
* `title_and_tags_from_metadata_json` Adds the title and tags from a metadata.json file in the same folder as the image to the prompt. This is useful if you have a metadata.json file in each folder with the images that applies to all the images in that folder. The metadata.json file should look like this:
```json
{
"title": "A photograph of John Smith",
@ -96,10 +96,13 @@ This is very useful if you can organize your data into folders that are meaningf
```
And the prompt will be modified with the information pulled from the metadata.json file. The prompt will look like this after modification:
```
Hint: title: A photograph of John Smith, tags: portrait, outdoors, smiling.
Hint: title: A photograph of John Smith, tags: portrait, outdoors, smiling
Write a description.
```
* `title_and_tags_from_image_json` Same as above but looks for a file ending in `.json` with the same basename and in the same directory as the image, enabling *per-image* metadata.
### Programming your own plugins.
The plugins are all in `/plugins/caption_plugins.py` and are easy to modify or add to. The plugins are executed in the order they are provided on the command line. Inherit from the `PromptIdentityPlugin` class and spass a key for the arg and your function like `super().__init(key="my_cool_plugin",fn=your_fn)`. Should be obvious from there for anyone familiar with Python.