Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Environment variables
.env
.env.local
.env.*.local

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
.venv/
env/
ENV/
env.bak/
venv.bak/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Jupyter Notebook
.ipynb_checkpoints

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/

# Logs
*.log
logs/

# Temporary files
*.tmp
*.temp
tmp/
temp/
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Image Description Generator

A FastAPI web application that generates detailed descriptions of images using Claude's vision capabilities.

## Features

- 🖼️ **Image Upload UI**: Drag-and-drop or browse to upload images
- 🔄 **HEIC Support**: Automatically converts HEIC images to JPEG
- 📏 **Smart Resizing**: Automatically optimizes large images (max 5MB, 1568px)
- 🎨 **Multiple Formats**: Supports JPEG, PNG, WebP, GIF, and HEIC
- 🤖 **AI-Powered**: Uses Claude Sonnet 4.5 for detailed image descriptions
- ⚡ **Real-time Processing**: Fast image analysis with loading indicators

## Project Structure

```
Oct-4-Hackathon-2025-/
├── src/
│ ├── __init__.py # Package initialization
│ ├── img_generator.py # Main FastAPI application
│ ├── vocab_generator.py # Vocabulary generation utilities
│ ├── text_to_speek.py # Text-to-speech functionality
│ └── .env # Environment variables
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # This file
```

## Setup

### 1. Create Virtual Environment

```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```

### 2. Install Dependencies

```bash
pip install -r requirements.txt
```

### 3. Configure Environment Variables

Create a `.env` file in the `src/` directory:

```env
ANTHROPIC_API_KEY=your_api_key_here
IMG_GENERATOR_ANTHRPIC_API_KEY=your_api_key_here
```

### 4. Run the Application

```bash
python src/img_generator.py
```

The application will be available at `http://localhost:8000`

## Usage

1. Open your browser and navigate to `http://localhost:8000`
2. Upload an image by:
- Dragging and dropping it into the upload area
- Clicking "Browse Files" to select an image
3. Click "Analyze Image" to generate a description
4. View the AI-generated description below

## API Endpoints

### `GET /`
Returns the web UI for image upload

### `POST /describe-image`
Upload an image and receive a detailed description

**Request:**
- Method: `POST`
- Content-Type: `multipart/form-data`
- Body: `file` (image file)

**Response:**
```json
{
"success": true,
"filename": "example.jpg",
"description": "Detailed image description...",
"model": "claude-sonnet-4-5-20250929"
}
```

## Supported Image Formats

- JPEG/JPG
- PNG
- WebP
- GIF
- HEIC (automatically converted to JPEG)

## Image Processing Features

- **Automatic HEIC Conversion**: HEIC images are converted to JPEG for API compatibility
- **Smart Resizing**: Images larger than 5MB or exceeding 1568px in any dimension are automatically resized
- **Quality Optimization**: Uses LANCZOS resampling and compression for optimal quality/size balance

## Technologies Used

- **FastAPI**: Web framework
- **Anthropic Claude API**: AI image description
- **Pillow**: Image processing
- **pillow-heif**: HEIC format support

## License

MIT License
51 changes: 51 additions & 0 deletions README_WEB_UI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Infinite Craft-Style Context Wordlist Generator

A beautiful web UI inspired by Infinite Craft that generates contextual wordlists using AI.

## Setup

All dependencies are already installed in the `myenv` conda environment!

**To run the app:**
```bash
./run_app.sh
```

Or manually activate the conda environment:
```bash
conda activate myenv
python app.py
```

**Open your browser:**
Navigate to http://localhost:5000

> Note: API keys are already configured in the code

## Usage

1. Enter any context in the input field (e.g., "software development team meeting", "cooking in a professional kitchen", "underwater marine biology")
2. Click "Generate Words"
3. Wait a moment while AI generates ~100 relevant vocabulary terms
4. Terms appear as draggable cards in the Infinite Craft style
5. Use the search box to filter terms
6. Click the download button to export the wordlist as a text file
7. Click the trash icon to clear all terms

## Features

- 🎨 **Infinite Craft-style UI** with animated particle background
- 📝 **Context-based generation** using Claude and OpenAI embeddings
- 🔍 **Real-time search** to filter displayed terms
- 📥 **Export functionality** to download wordlists
- 🎯 **Draggable cards** for visual organization
- ⚡ **Fast and efficient** vocabulary generation

## How It Works

The app uses:
- **Claude (Sonnet 4.5)** to generate candidate terms
- **OpenAI embeddings** for semantic similarity
- **spaCy** for linguistic analysis
- **MMR algorithm** for diversity
- **Category-based quotas** for balanced results
Loading