3v324v23 commited on
Commit
f37284b
·
1 Parent(s): 385fa9e
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -1,4 +1,22 @@
1
  import streamlit as st
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import os
3
+ import cv2
4
 
5
+ def get_image_path(img):
6
+ # Create a directory and save the uploaded image.
7
+ file_path = f"data/uploadedImages/{img.name}"
8
+ os.makedirs(os.path.dirname(file_path), exist_ok=True)
9
+ with open(file_path, "wb") as img_file:
10
+ img_file.write(img.getbuffer())
11
+ return file_path
12
+
13
+ uploaded_file = st.file_uploader("**Upload a Chest X-Ray Image**", type= ['png', 'jpg'] )
14
+ if uploaded_file is not None:
15
+ # Get actual image file
16
+ bytes_data = get_image_path(uploaded_file)
17
+ st.image(bytes_data)
18
+ # ReSize
19
+ item = cv2.resize(bytes_data,dsize=(224,224), interpolation=cv2.INTER_CUBIC)
20
+ # ReScale Values
21
+ item = item / 255
22
+ st.image(item)