Update src/streamlit_app.py
Browse files- src/streamlit_app.py +12 -9
src/streamlit_app.py
CHANGED
|
@@ -1,17 +1,20 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
| 4 |
|
| 5 |
-
st.title("
|
| 6 |
|
| 7 |
-
uploaded_file = st.file_uploader("
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
|
| 12 |
-
img = cv2.imdecode(file_bytes, cv2.IMREAD_COLOR)
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
st.success("
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
import numpy as np
|
| 4 |
import cv2
|
| 5 |
|
| 6 |
+
st.title("Upload & View Image")
|
| 7 |
|
| 8 |
+
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
| 9 |
|
| 10 |
+
# This prints info to Streamlit console
|
| 11 |
+
st.write("Uploaded file:", uploaded_file)
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
if uploaded_file is not None:
|
| 14 |
+
# Make sure to open the uploaded file
|
| 15 |
+
image = Image.open(uploaded_file)
|
| 16 |
+
st.image(image, caption="Original Image", use_column_width=True)
|
| 17 |
|
| 18 |
+
st.success("Image loaded successfully!")
|
| 19 |
+
else:
|
| 20 |
+
st.info("Please upload an image.")
|