A fun AI-powered web application that analyzes Halloween costumes and provides humorous roasts with voice narration. Built for Hack-or-Treat 2025.
- Image Upload: Drag-and-drop or browse to upload costume photos
- AI Roasting: Get playful, humorous feedback on your costume using Gemini AI
- Voice Narration: Listen to your roast with text-to-speech
- Interactive Modifications: Chat with AI to modify and enhance your costume
- Privacy-First: All processing happens in your browser - no data is stored
- Next.js 16 with App Router
- React 19
- TypeScript
- Tailwind CSS v4
- Google Gemini AI for image analysis and text generation
- Web Speech API for text-to-speech
- Node.js 18+ installed
- A Google Gemini API key (Get one here)
- Clone the repository:
git clone <repository-url>
cd hack-or-treat-- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.local- Add your Gemini API key to
.env.local:
GEMINI_API_KEY=your_gemini_api_key_here
- Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev- Open http://localhost:3000 in your browser
- Upload Your Costume: Click "Upload Costume" and select or drag-and-drop a photo of your Halloween costume
- Get Roasted: The AI will automatically analyze your costume and generate a playful roast
- Listen to the Roast: Click the play button in the bottom player to hear your roast with text-to-speech
- Modify Your Costume: Use the chat interface on the right to request modifications (e.g., "add a witch hat", "make it more colorful")
- Compare Results: View your original image and AI-modified versions side-by-side
src/
├── app/
│ ├── api/
│ │ ├── generate-roast/ # API endpoint for generating roasts
│ │ └── modify-image/ # API endpoint for image modifications
│ ├── results/ # Results page with roast player and chat
│ ├── globals.css # Global styles and Halloween theme
│ ├── layout.tsx # Root layout with metadata
│ └── page.tsx # Homepage with upload interface
├── components/
│ └── ImageUpload.tsx # Drag-and-drop upload component
├── types/
│ └── upload.ts # TypeScript type definitions
└── utils/
└── imageValidation.ts # Image validation utilities
Analyzes a costume image and generates a humorous roast.
Request Body:
{
"imageData": "data:image/jpeg;base64,..."
}Response:
{
"success": true,
"roast": "Your costume roast text here...",
"timestamp": "2025-10-29T12:00:00.000Z"
}Analyzes modification requests and provides guidance on costume changes.
Request Body:
{
"imageData": "data:image/jpeg;base64,...",
"prompt": "add a witch hat",
"conversationHistory": [...]
}Response:
{
"success": true,
"analysis": "I'll add a witch hat to your costume...",
"message": "Image modification analysis complete"
}- Image Generation: The chat feature currently provides text analysis of requested modifications. Actual visual image generation would require integration with an image generation API like DALL-E, Stable Diffusion, or Google's Imagen.
- Voice Options: Uses the browser's default text-to-speech voice. For better quality, consider integrating ElevenLabs or Google Cloud Text-to-Speech.
- Integrate image generation API for visual costume modifications
- Add premium voice options with more personality
- Implement costume style suggestions
- Add sharing functionality for roasts
- Create a gallery of best roasts (with user permission)
- Add costume rating system
- Multi-language support
This application is designed with privacy in mind:
- Images are processed client-side and stored only in sessionStorage
- No images are permanently saved to a database
- API calls to Gemini AI are made server-side to protect your API key
- Session data is cleared when you close the browser tab
This is a hackathon project for Hack-or-Treat 2025. Contributions, issues, and feature requests are welcome!
This project is built for educational and entertainment purposes as part of Hack-or-Treat 2025.