Anirban Chakraborty
first push
016987d
raw
history blame contribute delete
744 Bytes
import streamlit as st
import os, requests
upload_folder = 'uploaded_image'
#check if the folder is available or not
if not os.path.exists(upload_folder):
os.mkdir(upload_folder)
st.header("upload Image and get a description of it")
uploaded_file = st.file_uploader("Choose and image .....", type=['jpg','jpeg','png'])
if uploaded_file is not None:
#get the file name and save path
file_name = uploaded_file.name
saved_path = os.path.join(upload_folder,file_name)
#save the file to a local folder
with open(saved_path,'wb') as f:
f.write(uploaded_file.getbuffer())
st.success(f'Image successfully uploaded to {saved_path}')
st.image(uploaded_file,caption='Uploaded Image', use_column_width=True)