Skip to content

A web-based application that generates descriptive captions for uploaded images using Hugging Face’s "Salesforce/blip-image-captioning-large" model. Built with Gradio and deployed on Hugging Face Spaces, the app provides a simple interface for transforming images into meaningful text descriptions.

Notifications You must be signed in to change notification settings

abhi227070/Image-to-text-gradio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Image-to-Text Application

An application that generates descriptive captions for images using a deep learning model. The app leverages Hugging Face’s Salesforce/blip-image-captioning-large model for image-to-text transformation and is deployed on Hugging Face Spaces using Gradio.

Table of Contents

Features

  • Image Captioning: Generates captions that describe the contents of an image.
  • User-Friendly Interface: Built with Gradio for an easy-to-use web interface.
  • Deployed on Hugging Face: Accessible online for quick testing and demonstrations.

Installation

To run this application locally, follow these steps:

  1. Clone the Repository:
    git clone https://github.com/your-username/your-repo-name.git
    cd your-repo-name
  2. Install Dependencies: Ensure you have Python installed, then install the required libraries:
    pip install -r requirements.txt
    

Usage

  1. Run the application with:
    python app.py
    

Example Code

  1. Here’s a quick look at the core functionality:
    from transformers import pipeline
    from PIL import Image
    import gradio as gr
    
    model = None
    
    if model == None:
        model = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large")
    
    def captioner(image):
        img = Image.fromarray(image)
        result = model(img)[0]['generated_text']
        return result
    
    iface = gr.Interface(
        fn=captioner,
        inputs=gr.Image(),
        outputs='text'
    )
    
    iface.launch()

Deployement

  • The app is deployed on Hugging Face Spaces. You can try it directly by uploading images to receive captions generated by the model.

Credits

  • Transformers by Hugging Face for the image captioning model.
  • Gradio for the web interface.
  • Hugging Face for providing an easy deployment platform through Spaces.

About

A web-based application that generates descriptive captions for uploaded images using Hugging Face’s "Salesforce/blip-image-captioning-large" model. Built with Gradio and deployed on Hugging Face Spaces, the app provides a simple interface for transforming images into meaningful text descriptions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages