This repository contains a simple web application built using Streamlit that leverages OpenAI's GPT-4 Vision API to generate captions for uploaded images. Users can upload an image, select a desired vibe (e.g., fun, serious, cute), and optionally provide additional context. The app will then generate three unique captions tailored to the selected vibe and context.
- Image Upload: Users can upload images in various formats (JPG, JPEG, PNG) up to a maximum size of 4MB.
- Vibe Selection: Users can choose from a list of predefined vibes (e.g., fun, joke, serious, cute, controversial) to influence the tone and mood of the generated captions.
- Additional Prompt (Optional): Users can provide an additional prompt or context to further guide the caption generation process.
- Caption Generation: The app leverages OpenAI's GPT-4 Vision API to analyze the uploaded image and generate three unique and relevant captions based on the selected vibe and any additional context provided.
- Caption Display: The generated captions are displayed on the app's interface, allowing users to choose the most suitable caption for their image.
- Python 3.x
- Streamlit
- OpenAI API key
- Clone the repository: git clone git@github.com:manjurulhoque/openai-streamlit-caption-generator.git
- Install the required dependencies: pip install -r requirements.txt
- Set up your OpenAI API key as a Streamlit secret: mkdir -p ~/.streamlit/ echo "[general] secret_key = 'your_openai_api_key_here'" > ~/.streamlit/secrets.toml
- Run the Streamlit app: streamlit run app.py
- The app will open in your default web browser.
- Upload an image, select a vibe, and optionally provide additional context.
- Click the "Generate Captions" button to generate captions for your image.
- The generated captions will be displayed on the app's interface.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.