smishr-18 commited on
Commit
909e380
·
verified ·
1 Parent(s): b1969a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -8,7 +8,7 @@ from PIL import Image
8
  import numpy as np
9
  import config.configure as config
10
  from src.pipelines.predict import predict_mask
11
-
12
  model = UNet(3, 1, [64, 128, 256, 512])
13
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
14
 
@@ -22,10 +22,29 @@ transform = A.Compose([
22
  ])
23
  # Streamlit app
24
  def main():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  st.title("MRI segmenation App")
26
 
27
  # Upload image through Streamlit
28
- uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
29
 
30
  if uploaded_image is not None:
31
  # Display the uploaded and processed images side by side
@@ -40,7 +59,7 @@ def main():
40
 
41
  # Display the processed image in the second column
42
  col2.header("Processed Image")
43
- col2.image(processed_image, caption="Segmented Image", use_column_width=True)
44
 
45
  # Function to generate an image using the PyTorch model
46
  def generate_image(uploaded_image):
 
8
  import numpy as np
9
  import config.configure as config
10
  from src.pipelines.predict import predict_mask
11
+ import os
12
  model = UNet(3, 1, [64, 128, 256, 512])
13
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
14
 
 
22
  ])
23
  # Streamlit app
24
  def main():
25
+ page_bg_img = '''
26
+ <style>
27
+ .stApp {
28
+ background-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ5xTkOsu0UGhx3csUXvFKBPn0LdyvWjALhiw&usqp=CAU");
29
+ background-size: cover;
30
+ }
31
+ .stSelectbox {
32
+ background-color:white; /* Replace with the desired background color */
33
+ color:white; /* Replace with the desired text color */
34
+ }
35
+ .stsubheader {
36
+ background-color:white;
37
+ color:white;
38
+ }
39
+ </style>
40
+ '''
41
+
42
+ st.markdown(page_bg_img, unsafe_allow_html=True)
43
+
44
  st.title("MRI segmenation App")
45
 
46
  # Upload image through Streamlit
47
+ uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png", "tiff"])
48
 
49
  if uploaded_image is not None:
50
  # Display the uploaded and processed images side by side
 
59
 
60
  # Display the processed image in the second column
61
  col2.header("Processed Image")
62
+ col2.image(processed_image, caption="Processed Image", use_column_width=True)
63
 
64
  # Function to generate an image using the PyTorch model
65
  def generate_image(uploaded_image):