diff --git a/gen_alt_text.py b/gen_alt_text.py index 3e0126f..5073bed 100644 --- a/gen_alt_text.py +++ b/gen_alt_text.py @@ -11,6 +11,18 @@ Options: -m MODEL Use MODEL as the model. If MODEL is not provided, it defaults to llama3.2-vision:11b. +Supported vision models: + - llama3.2-vision:11b + - llama3.2-vision:90b + - llava:7b + - llava:13b + - llava:34b + - llava-llama3:8b + - bakllava:7b + - moondream:1.8b + - llava-phi3:3.8b + - minicpm-v:8b + Examples: gen-alt-text -m llama3.2-vision:90b ~/pictures/rubber_duck.jpg gen-alt-text ~/pictures/coffee.jpg @@ -26,8 +38,35 @@ from rich.markdown import Markdown def main(): args = docopt(__doc__) + vision_models = [ + "llama3.2-vision:11b", + "llama3.2-vision:90b", + "llava:7b", + "llava:13b", + "llava:34b", + "llava-llama3:8b", + "bakllava:7b", + "moondream:1.8b", + "llava-phi3:3.8b", + "minicpm-v:8b", + ] + + print() + console = Console() + if args["-m"]: - model = args["-m"] + if args["-m"] not in vision_models: + console.print( + "You must use a vision model to generate alt-text from images." + ) + print() + console.print("[bold magenta]Available vision models:[/bold magenta]") + for model in vision_models: + print(f"- {model}") + print() + exit("Select a model above and run the command again.") + else: + model = args["-m"] else: model = "llama3.2-vision:11b" @@ -36,8 +75,6 @@ def main(): else: client = Client(host="http://localhost:11434") - print() - console = Console() try: with console.status( f"[bold magenta] {model}[/bold magenta] is generating alt-text for " diff --git a/pyproject.toml b/pyproject.toml index e5ad9fd..237e07c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gen-alt-text" -version = "0.1" +version = "0.2" authors = [ { name="Jeffrey Serio", email="hyperreal@fedoraproject.org" }, ]