PrakhAI commited on
Commit
adcf297
·
1 Parent(s): 27d31c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -7
app.py CHANGED
@@ -20,15 +20,25 @@ 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
- # Specify brush parameters and drawing mode
24
- b_width = st.sidebar.slider("Brush width: ", 1, 100, 10)
25
- b_color = st.sidebar.color_picker("Enter brush color hex: ")
26
- bg_color = st.sidebar.color_picker("Enter background color hex: ", "#eee")
27
- drawing_mode = st.sidebar.checkbox("Drawing mode ?", True)
28
 
29
- # Create a canvas component
30
  image_data = st_canvas(
31
- b_width, b_color, bg_color, height=150, drawing_mode=drawing_mode, key="canvas"
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  )
33
 
 
 
 
34
 
 
20
  # x = st.slider('Select a value')
21
  # st.write(x, 'squared is', x * x)
22
 
 
 
 
 
 
23
 
 
24
  image_data = 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",
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