FreeAI / app.py
javeed3030's picture
renamed
53b3d8d
raw
history blame contribute delete
621 Bytes
import streamlit as st
# pipelines will help to load the model from huggingface
from transformers import pipeline
# load_dotenv(find_dotenv())
st.title("Image to text generation App πŸ•΅οΈβ€β™‚οΈ")
uploaded_file = st.file_uploader("Choose a file..",type= ['png', 'jpg'])
if uploaded_file is not None:
up_image=uploaded_file.name
#st.image(up_image)
st.image(up_image,caption="Uploaded Image",use_column_width=True)
image_to_text=pipeline("image-to-text", model="Salesforce/blip-image-captioning-large")
text=image_to_text(up_image)[0]["generated_text"]
st.subheader(text)
# #return text