|
import streamlit as st |
|
import os, requests |
|
|
|
upload_folder = 'uploaded_image' |
|
|
|
|
|
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: |
|
|
|
file_name = uploaded_file.name |
|
saved_path = os.path.join(upload_folder,file_name) |
|
|
|
|
|
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) |