PrakhAI commited on
Commit
775b079
·
1 Parent(s): 8f65f13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -24
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 canvas():
24
- with st.echo("below"):
25
- canvas_result = st_canvas(
26
- fill_color="rgba(255, 165, 0, 0.3)", # Fixed fill color with some opacity
27
- stroke_width=st.sidebar.slider("Brush width: ", 1, 100, 10),
28
- stroke_color=st.sidebar.color_picker("Enter brush color hex: "),
29
- background_color=st.sidebar.color_picker("Enter background color hex: ", "#eee"),
30
- background_image=None,
31
- update_streamlit=st.sidebar.checkbox("Update in realtime", True),
32
- height=150,
33
- drawing_mode=st.sidebar.checkbox("Drawing mode ?", True),
34
- point_display_radius=point_display_radius if st.sidebar.selectbox(
35
- "Drawing tool:",
36
- ("freedraw", "line", "rect", "circle", "transform", "polygon", "point"),
37
- ) == "point" else 0,
38
- display_toolbar=st.sidebar.checkbox("Display toolbar", True),
39
- key="canvas",
40
- )
41
-
42
- # Do something interesting with the image data and paths
43
- if canvas_result.image_data is not None:
44
- st.image(canvas_result.image_data)
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()