Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -28,18 +28,15 @@ drawing_mode = st.sidebar.selectbox(
|
|
28 |
stroke_width = st.sidebar.slider("Stroke width: ", 1, 25, 3)
|
29 |
if drawing_mode == "point":
|
30 |
point_display_radius = st.sidebar.slider("Point display radius: ", 1, 25, 3)
|
31 |
-
stroke_color = st.sidebar.color_picker("Stroke color hex: ")
|
32 |
-
bg_color = st.sidebar.color_picker("Background color hex: ", "#eee")
|
33 |
-
bg_image = st.sidebar.file_uploader("Background image:", type=["png", "jpg"])
|
34 |
realtime_update = st.sidebar.checkbox("Update in realtime", True)
|
35 |
|
36 |
# Create a canvas component
|
37 |
canvas_result = st_canvas(
|
38 |
-
fill_color="rgba(
|
39 |
stroke_width=stroke_width,
|
40 |
-
stroke_color=
|
41 |
-
background_color=
|
42 |
-
background_image=
|
43 |
update_streamlit=realtime_update,
|
44 |
height=150,
|
45 |
drawing_mode=drawing_mode,
|
@@ -51,9 +48,3 @@ canvas_result = st_canvas(
|
|
51 |
# Do something interesting with the image data and paths
|
52 |
if canvas_result.image_data is not None:
|
53 |
st.image(canvas_result.image_data)
|
54 |
-
if canvas_result.json_data is not None:
|
55 |
-
objects = pd.json_normalize(canvas_result.json_data["objects"])
|
56 |
-
for col in objects.select_dtypes(include=["object"]).columns:
|
57 |
-
objects[col] = objects[col].astype("str")
|
58 |
-
st.dataframe(objects)
|
59 |
-
|
|
|
28 |
stroke_width = st.sidebar.slider("Stroke width: ", 1, 25, 3)
|
29 |
if drawing_mode == "point":
|
30 |
point_display_radius = st.sidebar.slider("Point display radius: ", 1, 25, 3)
|
|
|
|
|
|
|
31 |
realtime_update = st.sidebar.checkbox("Update in realtime", True)
|
32 |
|
33 |
# Create a canvas component
|
34 |
canvas_result = st_canvas(
|
35 |
+
fill_color="rgba(0, 0, 0, 0)", # Fixed fill color with some opacity
|
36 |
stroke_width=stroke_width,
|
37 |
+
stroke_color="rgba(255, 255, 255, 0)",
|
38 |
+
background_color="rgba(0, 0, 0, 0)",
|
39 |
+
background_image=None,
|
40 |
update_streamlit=realtime_update,
|
41 |
height=150,
|
42 |
drawing_mode=drawing_mode,
|
|
|
48 |
# Do something interesting with the image data and paths
|
49 |
if canvas_result.image_data is not None:
|
50 |
st.image(canvas_result.image_data)
|
|
|
|
|
|
|
|
|
|
|
|