• bitcoinBitcoin(BTC)$84,080.00-2.47%
  • ethereumEthereum(ETH)$2,675.52-2.65%
  • tetherTether(USDT)$1.000.00%
  • binancecoinBNB(BNB)$766.10-2.81%
  • rippleXRP(XRP)$1.49-5.81%
  • usd-coinUSDC(USDC)$1.000.00%
  • solanaSolana(SOL)$114.66-2.81%
  • tronTRON(TRX)$0.342798-0.15%
  • zcashZcash(ZEC)$1,490.28-6.60%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.040.36%
  • HyperliquidHyperliquid(HYPE)$92.42-4.59%
  • dogecoinDogecoin(DOGE)$0.092572-8.67%
  • moneroMonero(XMR)$556.79-1.66%
  • whitebitWhiteBIT Coin(WBT)$84.49-2.48%
  • USDSUSDS(USDS)$1.000.01%
  • chainlinkChainlink(LINK)$12.23-5.66%
  • cardanoCardano(ADA)$0.236235-6.45%
  • RainRain(RAIN)$0.012224-6.58%
  • leo-tokenLEO Token(LEO)$8.96-0.43%
  • stellarStellar(XLM)$0.199969-7.75%
  • bitcoin-cashBitcoin Cash(BCH)$337.47-0.95%
  • uniswapUniswap(UNI)$9.28-10.84%
  • nearNEAR Protocol(NEAR)$4.29-0.91%
  • Ethena USDeEthena USDe(USDE)$1.00-0.01%
  • litecoinLitecoin(LTC)$61.98-0.51%
  • daiDai(DAI)$1.000.01%
  • avalanche-2Avalanche(AVAX)$10.19-7.62%
  • USD1USD1(USD1)$1.000.00%
  • CantonCanton(CC)$0.108632-4.22%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.41-3.60%
  • hedera-hashgraphHedera(HBAR)$0.089443-10.72%
  • suiSui(SUI)$0.95-6.20%
  • shiba-inuShiba Inu(SHIB)$0.000006-8.54%
  • Global DollarGlobal Dollar(USDG)$1.00-0.01%
  • BittensorBittensor(TAO)$283.71-8.75%
  • crypto-com-chainCronos(CRO)$0.060970-8.90%
  • BitwayBitway(BTW)$1.0618.86%
  • MemeCoreMemeCore(M)$1.23-5.14%
  • paypal-usdPayPal USD(PYUSD)$1.000.01%
  • tether-goldTether Gold(XAUT)$4,286.05-1.35%
  • okbOKB(OKB)$118.58-3.90%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • Ripple USDRipple USD(RLUSD)$1.000.00%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.150.15%
  • mantleMantle(MNT)$0.65-3.64%
  • aaveAave(AAVE)$137.18-6.85%
  • EthenaEthena(ENA)$0.203663-5.60%
  • OndoOndo(ONDO)$0.408729-6.68%
  • AsterAster(ASTER)$0.70-3.97%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

A Coding Guide to Build a Multimodal Image Captioning App Using Salesforce BLIP Model, Streamlit, Ngrok, and Hugging Face

March 14, 2025
in AI & Technology
Reading Time: 4 mins read
A A
A Coding Guide to Build a Multimodal Image Captioning App Using Salesforce BLIP Model, Streamlit, Ngrok, and Hugging Face
ShareShareShareShareShare

In this tutorial, we’ll learn how to build an interactive multimodal image-captioning application using Google’s Colab platform, Salesforce’s powerful BLIP model, and Streamlit for an intuitive web interface. Multimodal models, which combine image and text processing capabilities, have become increasingly important in AI applications, enabling tasks like image captioning, visual question answering, and more. This step-by-step guide ensures a smooth setup, clearly addresses common pitfalls, and demonstrates how to integrate and deploy advanced AI solutions, even without extensive experience.

!pip install transformers torch torchvision streamlit Pillow pyngrok

First we install transformers, torch, torchvision, streamlit, Pillow, pyngrok, all necessary dependencies for building a multimodal image captioning app. It includes Transformers (for BLIP model), Torch & Torchvision (for deep learning and image processing), Streamlit (for creating the UI), Pillow (for handling image files), and pyngrok (for exposing the app online via Ngrok).

YOU MAY ALSO LIKE

Everything Announced At Meta Connect 2026

Meta Brings FDA-Cleared Hearing Enhancement To Its Smart Glasses

%%writefile app.py
import torch
from transformers import BlipProcessor, BlipForConditionalGeneration
import streamlit as st
from PIL import Image


device = "cuda" if torch.cuda.is_available() else "cpu"


@st.cache_resource
def load_model():
    processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
    model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base").to(device)
    return processor, model


processor, model = load_model()


st.title("🖼️ Image Captioning with BLIP")


uploaded_file = st.file_uploader("Upload your image:", type=["jpg", "jpeg", "png"])


if uploaded_file is not None:
    image = Image.open(uploaded_file).convert('RGB')
    st.image(image, caption="Uploaded Image", use_column_width=True)


    if st.button("Generate Caption"):
        inputs = processor(image, return_tensors="pt").to(device)
        outputs = model.generate(**inputs)
        caption = processor.decode(outputs[0], skip_special_tokens=True)
        st.markdown(f"### ✅ **Caption:** {caption}")

Then we create a Streamlit-based multimodal image captioning app using the BLIP model. It first loads the BLIPProcessor and BLIPForConditionalGeneration from Hugging Face, allowing the model to process images and generate captions. The Streamlit UI enables users to upload an image, displays it, and generates a caption upon clicking a button. The use of @st.cache_resource ensures efficient model loading, and CUDA support is utilized if available for faster processing.

from pyngrok import ngrok


NGROK_TOKEN = "use your own NGROK token here"
ngrok.set_auth_token(NGROK_TOKEN)


public_url = ngrok.connect(8501)
print("🌐 Your Streamlit app is available at:", public_url)


# run streamlit app
!streamlit run app.py &>/dev/null &

Finally, we set up a publicly accessible Streamlit app running in Google Colab using ngrok. It does the following:  

  1. Authenticates ngrok using your personal token (`NGROK_TOKEN`) to create a secure tunnel.
  2. Exposes the Streamlit app running on port `8501` to an external URL via `ngrok.connect(8501)`.
  3. Prints the public URL, which can be used to access the app in any browser.
  4. Launches the Streamlit app (`app.py`) in the background.

This method lets you interact remotely with your image captioning app, even though Google Colab does not provide direct web hosting.

In conclusion, we’ve successfully created and deployed a multimodal image captioning app powered by Salesforce’s BLIP and Streamlit, hosted securely via ngrok from a Google Colab environment. This hands-on exercise demonstrated how easily sophisticated machine learning models can be integrated into user-friendly interfaces and provided a foundation for further exploring and customizing multimodal applications.


Here is the Colab Notebook. Also, don’t forget to follow us on Twitter and join our Telegram Channel and LinkedIn Group. Don’t Forget to join our 80k+ ML SubReddit.


Asif Razzaq is the CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.

Parlant: Build Reliable AI Customer Facing Agents with LLMs 💬 ✅ (Promoted)

Credit: Source link

ShareTweetSendSharePin

Related Posts

Everything Announced At Meta Connect 2026
AI & Technology

Everything Announced At Meta Connect 2026

September 24, 2026
Meta Brings FDA-Cleared Hearing Enhancement To Its Smart Glasses
AI & Technology

Meta Brings FDA-Cleared Hearing Enhancement To Its Smart Glasses

September 23, 2026
Microsoft’s New Surface Pro 12 And Surface Laptop 13 Feature Snapdragon X2 Plus Chips
AI & Technology

Microsoft’s New Surface Pro 12 And Surface Laptop 13 Feature Snapdragon X2 Plus Chips

September 23, 2026
Google Releases Gemini 3.8 Flash TTS and Flash-Lite TTS With Prompt-Based Voice Design
AI & Technology

Google Releases Gemini 3.8 Flash TTS and Flash-Lite TTS With Prompt-Based Voice Design

September 23, 2026
Next Post
Trump Tries Out a Tesla With Elon Musk

Trump Tries Out a Tesla With Elon Musk

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
Genetically modified beagle is hypoallergenic

Genetically modified beagle is hypoallergenic

September 21, 2026
Clippers owner suspended over salary cap scandal

Clippers owner suspended over salary cap scandal

September 18, 2026
ICE agents detain more than 100 people in Memphis

ICE agents detain more than 100 people in Memphis

September 20, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!