push app
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from PIL import Image, ImageDraw
|
| 4 |
import numpy as np
|
|
@@ -77,12 +78,18 @@ st.markdown(
|
|
| 77 |
canvas = st.empty()
|
| 78 |
|
| 79 |
# Camera input widget (opens device camera on mobile/desktop)
|
| 80 |
-
picture = st.camera_input("Take a picture")
|
|
|
|
| 81 |
|
|
|
|
| 82 |
if picture is not None:
|
| 83 |
-
# Open, crop & resize the captured image to 512x512
|
| 84 |
img = Image.open(picture)
|
| 85 |
img = crop_resize_image(img, size=512)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
# canvas.image(img, caption="Captured Image", use_container_width=True)
|
| 87 |
|
| 88 |
# Use the canvas container for all related UI elements
|
|
|
|
| 1 |
import os
|
| 2 |
+
import numpy as np
|
| 3 |
import streamlit as st
|
| 4 |
from PIL import Image, ImageDraw
|
| 5 |
import numpy as np
|
|
|
|
| 78 |
canvas = st.empty()
|
| 79 |
|
| 80 |
# Camera input widget (opens device camera on mobile/desktop)
|
| 81 |
+
# picture = st.camera_input("Take a picture")
|
| 82 |
+
|
| 83 |
|
| 84 |
+
picture = Image.new(mode="RGB", size=(512, 512), color=(153, 153, 255))
|
| 85 |
if picture is not None:
|
|
|
|
| 86 |
img = Image.open(picture)
|
| 87 |
img = crop_resize_image(img, size=512)
|
| 88 |
+
st.session_state.img = img # save the processed image
|
| 89 |
+
|
| 90 |
+
if "img" in st.session_state:
|
| 91 |
+
img = st.session_state.img
|
| 92 |
+
|
| 93 |
# canvas.image(img, caption="Captured Image", use_container_width=True)
|
| 94 |
|
| 95 |
# Use the canvas container for all related UI elements
|