File size: 3,043 Bytes
e82b768
e55e742
e82b768
 
 
 
 
 
e55e742
e82b768
 
 
98efca2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c35e90
 
 
 
 
 
 
98efca2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
title: Funny Image Captioner
emoji: 🚀
colorFrom: pink
colorTo: gray
sdk: gradio
sdk_version: 5.22.0
app_file: app.py
pinned: true
short_description: App that gives funny descriptions of images
---

# Fun Image Caption

A delightful app that captions your images through the voice of unique characters. Built with Gradio, LangGraph, and Hugging Face models.

## Description

This project creates an interactive AI application that captions and describes images in entertaining character voices. It combines modern vision-language models with a user-friendly interface to make image descriptions more engaging and fun.

## Features

- Upload any image for captioning
- Choose from multiple voice personas:
  - Scurvy-ridden pirate
  - Forgetful wizard
  - Sarcastic teenager
- Two-step LangGraph workflow:
  - Image captioning with vision-language model
  - Creative voice-based description
- Built on efficient 4-bit quantized models for ZeroGPU environments

## Useful Poetry Commands

- Show all installed packages: `poetry show`
- Show detailed info about a specific package: `poetry show <package>`
- Show package location and details: `poetry show -v <package>`
- List virtual environments: `poetry env list`
- Show current environment info: `poetry env info`
- Export dependencies to requirements.txt: `uv pip compile pyproject.toml -o requirements.txt`

## Requirements

- Python 3.10+
- Poetry (Python package manager)
- Git
- CUDA-compatible GPU

## Installation

1. Install Poetry if you haven't already:
```bash
curl -sSL https://install.python-poetry.org | python3 -
```

2. Clone the repository:
```bash
git clone https://github.com/yourusername/fun-image-caption.git
cd fun-image-caption
```

3. Create and activate a new Poetry environment:
```bash
poetry env use python3.10
poetry shell
```

4. Install dependencies:
```bash
poetry install
```

5. Verify installation:
```bash
poetry show
```

## Install Huggingface hub for CLI commands
```bash
pip install huggingface_hub

huggingface-cli login
```

## Key Dependencies

- accelerate==1.2.1: Framework for efficient model deployment
- bitsandbytes==0.41.3.post2: Quantization library for model optimization
- torch==2.4.0: PyTorch for ML operations
- transformers==4.49.0: Hugging Face transformers library
- gradio: Web interface framework
- langgraph: Workflow orchestration for language model pipelines
- pillow: Python Imaging Library

## Usage

1. Run the application:
```bash
python app.py
```

2. Open your browser and navigate to the provided URL (typically http://127.0.0.1:7860)

3. Upload an image using the interface

4. Select a voice persona from the dropdown menu

5. Click "Generate Description" to see the results

6. Enjoy your image description in the selected character voice!

## Models

The application uses the following models:
- Image Captioning: google/gemma-3-12b-vision (4-bit quantized)
- Voice Description: google/gemma-3-12b (4-bit quantized)

## Author

[Your name and contact information]

## License

[License information to be added]