Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,27 +20,26 @@ print([(k, type(v)) for (k, v) in state.items()])
|
|
20 |
# x = st.slider('Select a value')
|
21 |
# st.write(x, 'squared is', x * x)
|
22 |
|
23 |
-
def
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
canvas()
|
|
|
20 |
# x = st.slider('Select a value')
|
21 |
# st.write(x, 'squared is', x * x)
|
22 |
|
23 |
+
def canvas_main():
|
24 |
+
canvas_result = st_canvas(
|
25 |
+
fill_color="rgba(255, 165, 0, 0.3)", # Fixed fill color with some opacity
|
26 |
+
stroke_width=st.sidebar.slider("Brush width: ", 1, 100, 10),
|
27 |
+
stroke_color=st.sidebar.color_picker("Enter brush color hex: "),
|
28 |
+
background_color=st.sidebar.color_picker("Enter background color hex: ", "#eee"),
|
29 |
+
background_image=None,
|
30 |
+
update_streamlit=st.sidebar.checkbox("Update in realtime", True),
|
31 |
+
height=150,
|
32 |
+
drawing_mode=st.sidebar.checkbox("Drawing mode ?", True),
|
33 |
+
point_display_radius=point_display_radius if st.sidebar.selectbox(
|
34 |
+
"Drawing tool:",
|
35 |
+
("freedraw", "line", "rect", "circle", "transform", "polygon", "point"),
|
36 |
+
) == "point" else 0,
|
37 |
+
display_toolbar=st.sidebar.checkbox("Display toolbar", True),
|
38 |
+
key="canvas_main",
|
39 |
+
)
|
40 |
+
|
41 |
+
# Do something interesting with the image data and paths
|
42 |
+
if canvas_result.image_data is not None:
|
43 |
+
st.image(canvas_result.image_data)
|
44 |
+
|
45 |
+
canvas_main()
|
|