{"id":14964846,"url":"https://github.com/agarzon/ollama-image-caption","last_synced_at":"2026-03-09T00:32:42.852Z","repository":{"id":255260618,"uuid":"849034984","full_name":"agarzon/ollama-image-caption","owner":"agarzon","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-28T21:36:04.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T15:42:14.903Z","etag":null,"topics":["caption","flux","llava","ollama","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agarzon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-28T21:23:16.000Z","updated_at":"2024-09-19T17:12:59.000Z","dependencies_parsed_at":"2024-08-28T23:05:58.654Z","dependency_job_id":null,"html_url":"https://github.com/agarzon/ollama-image-caption","commit_stats":null,"previous_names":["agarzon/ollama-image-caption"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agarzon/ollama-image-caption","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarzon%2Follama-image-caption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarzon%2Follama-image-caption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarzon%2Follama-image-caption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarzon%2Follama-image-caption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agarzon","download_url":"https://codeload.github.com/agarzon/ollama-image-caption/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agarzon%2Follama-image-caption/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30278537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["caption","flux","llava","ollama","stable-diffusion"],"created_at":"2024-09-24T13:33:51.511Z","updated_at":"2026-03-09T00:32:42.828Z","avatar_url":"https://github.com/agarzon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ollama image caption tool\n\nThis project provides a Python script that reads images from a specified folder, uses the `llava` model from the Ollama API to generate descriptions for each image, and saves these descriptions in a corresponding `.txt` file. This script is ideal for developers and researchers working with image datasets who need to generate textual descriptions automatically.\n\n## Features\n\n- **Automatic Image Description:** The script uses the `llava` model to describe images.\n- **Batch Processing:** Processes all images ('.png', '.jpg', '.jpeg') in the folder.\n- **Output to Text Files:** Saves descriptions in `.txt` files with the same names as the corresponding images.\n\n## How It Works\n\n1. The script converts images to base64 encoding.\n2. It sends the base64 image data to the Ollama API, specifying the `llava` model.\n3. The API returns a description of the image, which the script saves in a `.txt` file.\n\n## Installation\n\n### Prerequisites\n\n- **Python 3.9+**\n- **Pip** (Python package installer)\n- **Ollama API** running locally (default at `http://localhost:11434`)\n\n### Setup\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/agarzon/ollama-image-caption.git\n   cd ollama-image-caption\n   ```\n\n2. **Create and activate a virtual environment:**\n\n   - On Windows:\n     ```bash\n     python -m venv venv\n     venv\\Scripts\\activate\n     ```\n   - On macOS/Linux:\n     ```bash\n     python3 -m venv venv\n     source venv/bin/activate\n     ```\n\n3. **Install the required packages:**\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## Usage\n\n1. Put all the images you want to process in the `images` folder.\n\n2. **Activate the virtual environment:**\n\n   ```bash\n   source myenv/bin/activate\n   ```\n\n3. **Run the script:**\n\n   ```bash\n   python script_name.py\n   ```\n\n   Replace `script_name.py` with the name of your script.\n\n4. **Output:**\n   - The script processes each image in the specified folder and generates a `.txt` file with the description.\n\n## Example\n\nIf you have an image named `example.jpg`, the script will generate a description and save it in `example.txt` in the same folder.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n**Disclaimer:** This project is for educational and research purposes. Make sure to comply with the terms and conditions of the Ollama API and any other third-party services used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagarzon%2Follama-image-caption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagarzon%2Follama-image-caption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagarzon%2Follama-image-caption/lists"}