Spaces:
Runtime error
Runtime error
Commit
·
db3f49d
1
Parent(s):
9e5ec94
break
Browse files
app.py
CHANGED
@@ -1,89 +1,6 @@
|
|
1 |
import sys
|
2 |
|
3 |
-
|
4 |
-
"
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
st.set_page_config(
|
10 |
-
page_title="Streamlit Image Comparison",
|
11 |
-
page_icon="🔥",
|
12 |
-
layout="centered",
|
13 |
-
initial_sidebar_state="auto",
|
14 |
-
)
|
15 |
-
|
16 |
-
st.markdown(
|
17 |
-
"""
|
18 |
-
<h2 style='text-align: center'>
|
19 |
-
Streamlit Image Comparison Demo
|
20 |
-
</h2>
|
21 |
-
""",
|
22 |
-
unsafe_allow_html=True,
|
23 |
-
)
|
24 |
-
st.markdown(
|
25 |
-
"""
|
26 |
-
<p style='text-align: center'>
|
27 |
-
<a href='https://github.com/fcakyon/streamlit-image-comparison' target='_blank'>https://github.com/fcakyon/streamlit-image-comparison</a>
|
28 |
-
<br />
|
29 |
-
Follow me for more! <a href='https://twitter.com/fcakyon' target='_blank'> <img src="https://img.icons8.com/color/48/000000/twitter--v1.png" height="30"></a><a href='https://github.com/fcakyon' target='_blank'><img src="https://img.icons8.com/fluency/48/000000/github.png" height="27"></a><a href='https://www.linkedin.com/in/fcakyon/' target='_blank'><img src="https://img.icons8.com/fluency/48/000000/linkedin.png" height="30"></a> <a href='https://fcakyon.medium.com/' target='_blank'><img src="https://img.icons8.com/ios-filled/48/000000/medium-monogram.png" height="26"></a>
|
30 |
-
</p>
|
31 |
-
""",
|
32 |
-
unsafe_allow_html=True,
|
33 |
-
)
|
34 |
-
|
35 |
-
st.write("##")
|
36 |
-
|
37 |
-
with st.form(key="Streamlit Image Comparison"):
|
38 |
-
# image one inputs
|
39 |
-
col1, col2 = st.columns([3, 1])
|
40 |
-
with col1:
|
41 |
-
img1_url = st.text_input("Image one URL:", value=IMAGE_TO_URL["sample_image_1"])
|
42 |
-
with col2:
|
43 |
-
img1_text = st.text_input("Image one text:", value="YOLOX7")
|
44 |
-
|
45 |
-
# image two inputs
|
46 |
-
col1, col2 = st.columns([3, 1])
|
47 |
-
with col1:
|
48 |
-
img2_url = st.text_input("Image two URL:", value=IMAGE_TO_URL["sample_image_2"])
|
49 |
-
with col2:
|
50 |
-
img2_text = st.text_input("Image two text:", value="SAHI+YOLOX")
|
51 |
-
|
52 |
-
# continious parameters
|
53 |
-
col1, col2 = st.columns([1, 1])
|
54 |
-
with col1:
|
55 |
-
starting_position = st.slider(
|
56 |
-
"Starting position of the slider:", min_value=0, max_value=100, value=50
|
57 |
-
)
|
58 |
-
with col2:
|
59 |
-
width = st.slider(
|
60 |
-
"Component width:", min_value=400, max_value=1000, value=700, step=100
|
61 |
-
)
|
62 |
-
|
63 |
-
# boolean parameters
|
64 |
-
col1, col2, col3, col4 = st.columns([1, 3, 3, 3])
|
65 |
-
with col2:
|
66 |
-
show_labels = st.checkbox("Show labels", value=True)
|
67 |
-
with col3:
|
68 |
-
make_responsive = st.checkbox("Make responsive", value=True)
|
69 |
-
with col4:
|
70 |
-
in_memory = st.checkbox("In memory", value=True)
|
71 |
-
|
72 |
-
# centered submit button
|
73 |
-
col1, col2, col3 = st.columns([6, 4, 6])
|
74 |
-
with col2:
|
75 |
-
submit = st.form_submit_button("Update Render 🔥")
|
76 |
-
|
77 |
-
static_component = image_comparison(
|
78 |
-
img1=img1_url,
|
79 |
-
img2=img2_url,
|
80 |
-
label1=img1_text,
|
81 |
-
label2=img2_text,
|
82 |
-
width=width,
|
83 |
-
starting_position=starting_position,
|
84 |
-
show_labels=show_labels,
|
85 |
-
make_responsive=make_responsive,
|
86 |
-
in_memory=in_memory,
|
87 |
-
)
|
88 |
-
|
89 |
-
sys.exit()
|
|
|
1 |
import sys
|
2 |
|
3 |
+
if __name__ == "__main__":
|
4 |
+
print("Hello, World!")
|
5 |
+
1/0
|
6 |
+
print(sys.exit())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|