This Image Caption Generator is a web application built using Streamlit, a Python library for creating interactive web applications. It leverages Google's Generative AI API to generate captions for images. The application provides users with the flexibility to generate captions for images with customizable lengths and supports different platforms such as Instagram.
- Upload an image and generate a caption for it.
- Customize the length of the generated caption.
- Generate captions specifically tailored for Instagram.
To run the Image Caption Generator locally, follow these steps:
- Clone the repository containing the code.
- Navigate to the project directory.
- Create a Python virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On Unix or MacOS:
source venv/bin/activate
- On Windows:
- Install the required dependencies using pip:
pip install -r Requirements.txt
- Create a
.env
file in the project directory and add your Google Generative AI API key to it. For example:GENAI_API_KEY=YOUR_GENERATIVE_AI_API_KEY
To run the Image Caption Generator, execute the following command in your terminal:
streamlit run app.py
This will start a local web server hosting the application. You can access it by opening a web browser and navigating to http://localhost:8501
.
- Upload an image by clicking on the "Choose an image..." button.
- Use the slider to select the desired length of the generated caption.
- Click the "Identify image" button to generate a caption.
- Optionally, you can click the "Insta Caption" button to generate a caption specifically tailored for Instagram.
Contributions are welcome! Feel free to open issues or submit pull requests to improve the application.
This project is licensed under the terms of the MIT License, © 2024 @Humble2021.