|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Organize your photos with Open Interpreter" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "markdown", |
| 12 | + "metadata": {}, |
| 13 | + "source": [ |
| 14 | + "You can use Open Interpreter with a vision model to organize photos based on their contents. This is limited by the ability of the LLM as well as the organization of the directories storing photos. " |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "markdown", |
| 19 | + "metadata": {}, |
| 20 | + "source": [ |
| 21 | + "> Note: It is always recommended to back up photos and files on a regular basis. Most models are intelligent enough to know the difference between `move` and `delete` but on rare occasions, files can be deleted during some operations. It is important to test on duplicated photos and to keep an eye on code written by an LLM." |
| 22 | + ] |
| 23 | + }, |
| 24 | + { |
| 25 | + "cell_type": "markdown", |
| 26 | + "metadata": {}, |
| 27 | + "source": [ |
| 28 | + "Create a profile. This example uses GPT-4o but you can use any vision model." |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + "cell_type": "code", |
| 33 | + "execution_count": null, |
| 34 | + "metadata": {}, |
| 35 | + "outputs": [], |
| 36 | + "source": [ |
| 37 | + "\"\"\"\n", |
| 38 | + "This is an Open Interpreter profile to organize a directory of photos. \n", |
| 39 | + "\"\"\"\n", |
| 40 | + "\n", |
| 41 | + "from interpreter import interpreter\n", |
| 42 | + "\n", |
| 43 | + "\n", |
| 44 | + "# LLM settings\n", |
| 45 | + "interpreter.llm.model = \"gpt-4o\"\n", |
| 46 | + "#interpreter.llm.model = \"ollama/codestral\"\n", |
| 47 | + "interpreter.llm.supports_vision = True\n", |
| 48 | + "interpreter.llm.execution_instructions = False\n", |
| 49 | + "interpreter.llm.max_tokens = 1000\n", |
| 50 | + "interpreter.llm.context_window = 7000\n", |
| 51 | + "interpreter.llm.load() # Loads Ollama models\n", |
| 52 | + "\n", |
| 53 | + "# Computer settings\n", |
| 54 | + "interpreter.computer.import_computer_api = True\n", |
| 55 | + "\n", |
| 56 | + "# Misc settings\n", |
| 57 | + "interpreter.auto_run = False\n", |
| 58 | + "\n" |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "cell_type": "markdown", |
| 63 | + "metadata": {}, |
| 64 | + "source": [ |
| 65 | + "The following custom instruction is intended for a directory containing one sub-directory of unorganized photos and multiple empty sub-directories with names for the intended organization. Please update the custom instructions to match your use-case. This will take some trial and error, depending on the model used." |
| 66 | + ] |
| 67 | + }, |
| 68 | + { |
| 69 | + "cell_type": "code", |
| 70 | + "execution_count": null, |
| 71 | + "metadata": {}, |
| 72 | + "outputs": [], |
| 73 | + "source": [ |
| 74 | + "# Custom Instructions\n", |
| 75 | + "interpreter.custom_instructions=f\"\"\"\n", |
| 76 | + " Recap the plan before answering the user's query!\n", |
| 77 | + " Your job is to organize photos. You love organizing photos.\n", |
| 78 | + " You will be given a parent directory with sub-directories. \n", |
| 79 | + " One sub-directory will be of unorganized photos.\n", |
| 80 | + " The other sub-directories will be categories that you move the photos in to.\n", |
| 81 | + " Remember the sub-directories's names because they will be the categories for organizing.\n", |
| 82 | + " It is extremely important because these are the only options for where you move the photos.\n", |
| 83 | + " Loop through every photo in the unorganized photos directory. \n", |
| 84 | + " Skip over non-photo files by checking for common photo extensions (.jpg, .jpeg, .png, etc).\n", |
| 85 | + " In this loop you will determine the description of each image one at a time. \n", |
| 86 | + " Use `computer.vision.query()` to get a description of the image.\n", |
| 87 | + " `computer.vision.query()` takes a `path=` argument to know which photo to describe. \n", |
| 88 | + " Print out the description so you can get the full context.\n", |
| 89 | + " Determine which sub-directory the photo should go in to.\n", |
| 90 | + " Every photo needs to go into one of the sub-directories.\n", |
| 91 | + " Make sure you actually move the photo. \n", |
| 92 | + " Your task is done when every photo in the unorganized photos directory has been moved to another directory. \n", |
| 93 | + " **Confirm that the unorganized photos directory has no more photos**.\n", |
| 94 | + " \"\"\"\n" |
| 95 | + ] |
| 96 | + }, |
| 97 | + { |
| 98 | + "cell_type": "markdown", |
| 99 | + "metadata": {}, |
| 100 | + "source": [ |
| 101 | + "Save the profile with a descriptive name. Then run interpreter with:\n", |
| 102 | + "\n", |
| 103 | + "`interpreter --profile <profileName.py>`\n", |
| 104 | + "\n", |
| 105 | + "Then ask it to organize the directory:\n", |
| 106 | + "\n", |
| 107 | + "`Please organize this directory: /path/to/directory`" |
| 108 | + ] |
| 109 | + } |
| 110 | + ], |
| 111 | + "metadata": { |
| 112 | + "language_info": { |
| 113 | + "name": "python" |
| 114 | + } |
| 115 | + }, |
| 116 | + "nbformat": 4, |
| 117 | + "nbformat_minor": 2 |
| 118 | +} |
0 commit comments