Update app.py

#1
by hanriv - opened
Files changed (1) hide show
  1. app.py +31 -4
app.py CHANGED
@@ -3,16 +3,37 @@ import cv2
3
  import numpy as np
4
  from PIL import Image
5
 
 
6
  st.title("Image Processing MVP")
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
9
 
10
  if uploaded_file is not None:
11
  image = Image.open(uploaded_file)
12
- st.image(image, caption='Uploaded Image.', use_column_width=True)
13
- st.write("")
14
  st.write("Processing...")
15
-
16
  action = st.radio("Choose an action:", ('A', 'B'))
17
 
18
  image_np = np.array(image)
@@ -27,4 +48,10 @@ if uploaded_file is not None:
27
  x, y = np.random.randint(0, cols), np.random.randint(0, rows)
28
  cv2.circle(processed_image, (x, y), 10, (0, 0, 0), -1)
29
 
30
- st.image(processed_image, caption='Processed Image.', use_column_width=True)
 
 
 
 
 
 
 
3
  import numpy as np
4
  from PIL import Image
5
 
6
+ st.set_page_config(page_title="Image Processing MVP", layout="wide")
7
  st.title("Image Processing MVP")
8
 
9
+ st.markdown(
10
+ """
11
+ <style>
12
+ .stFileUploader label {
13
+ font-size: 20px;
14
+ font-weight: 500;
15
+ color: #1f77b4;
16
+ }
17
+ .stRadio label {
18
+ font-size: 20px;
19
+ font-weight: 500;
20
+ color: #1f77b4;
21
+ }
22
+ .stRadio div {
23
+ display: flex;
24
+ gap: 20px;
25
+ }
26
+ </style>
27
+ """,
28
+ unsafe_allow_html=True,
29
+ )
30
+
31
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
32
 
33
  if uploaded_file is not None:
34
  image = Image.open(uploaded_file)
35
+
 
36
  st.write("Processing...")
 
37
  action = st.radio("Choose an action:", ('A', 'B'))
38
 
39
  image_np = np.array(image)
 
48
  x, y = np.random.randint(0, cols), np.random.randint(0, rows)
49
  cv2.circle(processed_image, (x, y), 10, (0, 0, 0), -1)
50
 
51
+ col1, col2 = st.columns(2)
52
+
53
+ with col1:
54
+ st.image(image, caption='Uploaded Image', use_column_width=True)
55
+
56
+ with col2:
57
+ st.image(processed_image, caption='Processed Image', use_column_width=True)