File size: 1,175 Bytes
881e588
 
 
 
 
 
 
 
 
4ac4222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
881e588
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
---
title: Image Captioning with BLIP
emoji: 🖼️
colorFrom: blue
colorTo: indigo
sdk: gradio
app_file: app.py
pinned: false
---

# Image Captioning with BLIP

This project uses the Salesforce BLIP model to generate captions for images. It provides a simple web interface built with Gradio to upload an image and view the generated caption.

## Setup

1.  **Clone the repository:**
    ```bash
    git clone https://huggingface.co/spaces/electro-sb/image_captioning
    cd image_captioning
    ```

2.  **Install dependencies:**
    ```bash
    pip install -r requirements.txt
    ```

3.  **Set up your Hugging Face token:**
    Create a `.env` file in the root of the project and add your Hugging Face API key:
    ```
    HF_API_KEY=<your-hugging-face-api-key>
    ```

4.  **Run the application:**
    ```bash
    python app.py
    ```

    The application will be available at `http://localhost:7860`.

## Usage

1.  Open your web browser and navigate to `http://localhost:7860`.
2.  Upload an image using the provided interface.
3.  Click the "Caption" button to generate a caption for the image.
4.  The generated caption will be displayed in the "Caption" textbox.