{"id":14964794,"url":"https://github.com/cloudmedicio/describe-media-library","last_synced_at":"2025-04-04T04:31:45.320Z","repository":{"id":219744158,"uuid":"749798409","full_name":"cloudmedicio/describe-media-library","owner":"cloudmedicio","description":"Describe images in the WordPress Media Library using a local large language model. Generates titles, captions, descriptions, and alt tags.","archived":false,"fork":false,"pushed_at":"2024-01-29T15:16:33.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"production","last_synced_at":"2024-10-18T22:11:13.126Z","etag":null,"topics":["accessibility","alt-text","alt-text-generator","apple-silicon","computer-vision","gpt4","intel-mac","linux","llama2","llamacpp","llava","localwp","media-library","ollama","openai","plugin","search-engine-optimization","seo","wordpress","wp-cli"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudmedicio.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-29T12:24:28.000Z","updated_at":"2024-09-23T11:58:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f1f9261-bcac-4124-ba2a-cd0c23f23204","html_url":"https://github.com/cloudmedicio/describe-media-library","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"3f0a755e4c433c3c1de2bdad1ab14c8e4ad48fba"},"previous_names":["cloudmedicio/describe-media-library"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmedicio%2Fdescribe-media-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmedicio%2Fdescribe-media-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmedicio%2Fdescribe-media-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmedicio%2Fdescribe-media-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudmedicio","download_url":"https://codeload.github.com/cloudmedicio/describe-media-library/tar.gz/refs/heads/production","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123075,"owners_count":20887259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","alt-text","alt-text-generator","apple-silicon","computer-vision","gpt4","intel-mac","linux","llama2","llamacpp","llava","localwp","media-library","ollama","openai","plugin","search-engine-optimization","seo","wordpress","wp-cli"],"created_at":"2024-09-24T13:33:47.398Z","updated_at":"2025-04-04T04:31:40.311Z","avatar_url":"https://github.com/cloudmedicio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Purpose\n\nCreates image descriptions, captions, titles, and alt tags for image attachments in WordPress using a local large language model.\n\nNo data is sent to external services. All data is processed on the local machine.\n\nIn a WordPress context, types of text associated with images have these uses:\n\n- **Alt**: Displays on images as an image is loading. Relevant for accessibility, for example, screen readers, and search engines.\n- **Title**: Displays as a tooltip on mouse hover. May also be read by screen readers depending on user settings.\n- **Description**: Displays on image attachment page in WordPress themes. Also useful for search.\n- **Caption**: Displays below the image in the page layout.\n\n## Requirements\n\nThis plugin assumes WordPress is running on a [local installation](https://localwp.com), [Ollama.ai](https://ollama.ai) is installed, and you have access to `wp-cli`.\n\nOllama currently supports macOS and Linux, with a Windows version in progress. Testing was conducted on a 2012 Intel Mac mini and a 2022 M1 Mac mini. Intel processors will process images using the CPU, while Apple Silicon chips will make use of the Neural Engine, running much faster without using the main processor resources.\n\n#### Install Ollama\n\nGraphically: Download the app from [Ollama.ai](https://ollama.ai). Run the app, and click the button at launch to install command line tools.\n\nWith [Homebrew](https://brew.sh):\n\n```bash\nbrew install ollama\n```\n\n#### Use Ollama\n\n**Download a vision model**\n\n```bash\nollama pull llava\n```\n\n**Run the Language Model server**\n\nEither open the Ollama app, which will appear in the menu bar, or run in Terminal:\n\n```bash\nollama serve\n```\n\n#### Install `wp-cli`\n\n`wp-cli` comes bundled with [Local WP](https://localwp.com). It can also be installed with Homebrew:\n\n```bash\nbrew install wp-cli\n```\n\n#### Install this plugin\n\nOption 1: Add this plugin folder to `wp-content/plugins` and activate it.\n\nOption 2: Place the main PHP file in `wp-content/mu-plugins/describe-media-library.php`\n\n## Generate Image Descriptions\n\nOnce Ollama is running, image alt tags, descriptions, captions, and titles can be generated by running the plugin's command within a directory located in the WordPress installation:\n\n```bash\nwp _medic describe-images\n```\n\n...this will output descriptions to the terminal and save a CSV to `wp-content/uploads/image-descriptions.csv`.\n\nOnce there are descriptions in the CSV, the file may be reviewed or revised, then written to the WordPress database with:\n\n```bash\nwp _medic describe-images --write-to-db\n```\n\nUploading the plugin and CSV to a live site and running the above command provides a way to update images descriptions on a production installation without migrating a database.\n\n## Modify Description Guidelines\n\nWhen generating, these are the default inputs:\n\n```bash\nwp _medic describe-images \\\n   --alt=\"Please write a thorough description of the image in a format appropriate for an alt tag focused on accessibility.\" \\\n   --description=\"Please write a comma-separated list of keywords and relevant synonyms related to this image, focusing on relevancy for search.\" \\\n   --caption=\"Please write a descriptive caption for this image appropriate for displaying to a user reading an article where the image is referenced.\" \\\n   --title=\"Please write a short title for this image.\"\n```\n\nThese can be overriden to anything else:\n\n```bash\nwp _medic describe-images \\\n\t--alt=\"Describe the image for an accessible alt tag in French.\" \\\n\t--description=\"Write a comma-separated list of keywords and topics related to this image.\" \\\n\t--caption=\"Write a caption for this image in the form of a Haiku.\" \\\n\t--title=\"Describe this image using only emoji.\"\n```\n\nOr leave the argument blank to skip it.\n\ne.g., to write only alt tags:\n\n```bash\nwp _medic describe-images \\\n\t--alt=\"Please write a thorough description of the image in a format appropriate for an alt tag focused on accessibility.\" \\\n\t--description \\\n\t--caption \\\n\t--title\n```\n\n## Image Size\n\nThe default image size passed to the model is `large`. Any defined WordPress image size may be used, such as `thumbnail`, `medium`, `large`, or `full`. In testing on a Quad-Core Intel i7 Mac mini using CPU, `large` said it would take around 24 days to generate all 4 description types for `1,600 images`. However, switching to `medium` produced descriptions which seemed fabricated, so the default is `large`.\n\nThis will go slower, but is the default due to accuracy:\n\n```bash\nwp _medic describe-images --image_size=\"large\"\n```\n\nThis will go faster, but accuracy may degrade:\n\n```bash\nwp _medic describe-images --image_size=\"medium\"\n```\n\nIf doing this at scale, one would ideally have access to hardware with Apple Silicon, NVIDIA GPUs, or Cloud TPUs. Here, we make use of older hardware by designing systems which distribute tasks across many machines.\n\n## Collaborate with 🌦️️🩺️ Cloud Medic\n\n\u003e Do you have a project involving artificial intelligence, data engineering, or medicine you would like to bring to life?\n\nConnect with us at [make@cloudmedic.io](mailto:make@cloudmedic.io?subject=Collaboration\u0026body=Hi%21%20We%20saw%20your%20image%20description%20project%20on%20GitHub%2C%20and%20thought%20it%20might%20be%20related%20to%20something%20we%27re%20working%20on.%20Have%20time%20to%20connect%3F%20Here%20is%20a%20little%20bit%20about%20what%20we%27re%20thinking%3A)\n\nPlease use subject `Collaboration` and share short description of how we can help bring your ideas to reality.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudmedicio%2Fdescribe-media-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudmedicio%2Fdescribe-media-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudmedicio%2Fdescribe-media-library/lists"}