File size: 746 Bytes
1dc4501
e028124
b056b61
d14959e
b056b61
e028124
b056b61
 
 
 
 
 
 
 
 
 
 
 
 
 
d14959e
b056b61
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
from io import BytesIO
import imageio.v3 as iio
#import cv2
import os

def get_image_path(img):
    # Create a directory and save the uploaded image.
    file_path = f"data/uploadedImages/{img.name}"
    os.makedirs(os.path.dirname(file_path), exist_ok=True)
    with open(file_path, "wb") as img_file:
        img_file.write(img.getbuffer())
    return file_path

uploaded_file = st.file_uploader("**Upload a Chest X-Ray Image**", type= ['png', 'jpg'] )
if uploaded_file is not None:
    # Get actual image file
    bytes_data = get_image_path(uploaded_file)
    st.image(bytes_data)
    # ReSize
    #item = cv2.resize(bytes_data,dsize=(224,224), interpolation=cv2.INTER_CUBIC)
    # ReScale Values
    item = item / 255