Spaces:
Build error
Build error
File size: 621 Bytes
be4b1a8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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
|