Code Monkey home page Code Monkey logo

image-to-speech-genai-tool's Introduction

Image-to-Speech-GenAI-tool

An AI tool that receives an image and uses generative AI to create a narrated short story in an audio file about the context of the image.

The tool utilizes Hugging Face Transformers open-source framework for deep learning in combination with OpenAI prompting via Langchain framework.

Approach

Execution is devided into 3 parts:

  • Image to text: an image-to-text transformer model (Salesforce/blip-image-captioning-base) is used to generate a text scenario based on the on the AI understanding of the image context
  • Text to story: OpenAI LLM model is prompted to create a short story based on the generated scenario
  • Story to speech: a text-to-speech transformer model (espnet/kan-bayashi_ljspeech_vits) is used to convert the generated short story into a voice-narrated audio file
  • A user interface is built using streamlit to enable uploading the image and playing the audio file

requirements

  • os
  • dotenv
  • transformers
  • langchain
  • requests
  • streamlit

Using the app

  • Before using the app, the user should have personal tokens for Hugging Face and Open AI
  • The user should save the personal tokens in an ".env" file within the package as string objects under object names: HUGGINGFACE_TOKEN and OPENAI_TOKEN
  • The user can then run the app using the command: streamlit run app.py
  • Once the app is running on streamlit, the user can upload the target image
  • Execution will start automatically and it may take a few minutes to complete
  • Once completed, the app will display:
    • The scenario text generated by the image-to-text transformer model
    • The short story generated by prompting the OpenAI LLM
    • The autio file narrating the short story generated by the text-to-speech transformer model
  • The audio file along with the image will be saved in "audio-img" folder inside the package

image-to-speech-genai-tool's People

Contributors

moataz-ab avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.