Odin-son commited on
Commit
14a317e
·
1 Parent(s): 60f0a99

add form from original repo

Browse files
Files changed (1) hide show
  1. app.py +31 -2
app.py CHANGED
@@ -1,11 +1,40 @@
1
  import streamlit as st
2
  from streamlit_image_comparison import image_comparison
3
 
 
 
 
 
 
 
 
4
  # set page config
5
  st.set_page_config(page_title="Image-Comparison Example", layout="centered")
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  # render image-comparison
8
  image_comparison(
9
- img1="example/0001TP_009240.png",
10
- img2="example/0001TP_009240_L.png",
 
 
11
  )
 
1
  import streamlit as st
2
  from streamlit_image_comparison import image_comparison
3
 
4
+ IMAGE_PATH = {
5
+ "sample_image_1": "example/0001TP_009240.png",
6
+ "sample_image_2": "example/0001TP_009240_L.png",
7
+ }
8
+
9
+ st.write("##")
10
+
11
  # set page config
12
  st.set_page_config(page_title="Image-Comparison Example", layout="centered")
13
 
14
+ with st.form(key="Image Comparison"):
15
+ # image one inputs
16
+ col1, col2 = st.columns([3, 1])
17
+ with col1:
18
+ img1_url = st.text_input("Image one path:", value=IMAGE_PATH["sample_image_1"])
19
+ with col2:
20
+ img1_text = st.text_input("Image one text:", value="Input")
21
+
22
+ # image two inputs
23
+ col1, col2 = st.columns([3, 1])
24
+ with col1:
25
+ img2_url = st.text_input("Image two path:", value=IMAGE_PATH["sample_image_2"])
26
+ with col2:
27
+ img2_text = st.text_input("Image two text:", value="Labeled")
28
+
29
+ # centered submit button
30
+ col1, col2, col3 = st.columns([6, 4, 6])
31
+ with col2:
32
+ submit = st.form_submit_button("Update Render 🔥")
33
+
34
  # render image-comparison
35
  image_comparison(
36
+ img1=img1_url,
37
+ img2=img2_url,
38
+ label1=img1_text,
39
+ label2=img2_text,
40
  )