Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import utils
|
| 3 |
import cv2
|
| 4 |
-
import numpy
|
| 5 |
import io
|
| 6 |
import tempfile
|
| 7 |
from PIL import Image
|
|
@@ -28,7 +28,7 @@ if source_radio == "IMAGE":
|
|
| 28 |
input = st.sidebar.file_uploader("Choose an image.", type=("jpg", "png"))
|
| 29 |
if input is not None:
|
| 30 |
uploaded_image = Image.open(input)
|
| 31 |
-
uploaded_image_cv = cv2.cvtColor(
|
| 32 |
boxes, resized_image = utils.predict_image(uploaded_image_cv, conf_threshold = conf_threshold)
|
| 33 |
result_image = utils.convert_result_to_image(uploaded_image_cv, resized_image, boxes, conf_labels=False)
|
| 34 |
st.image(result_image, channels = "RGB")
|
|
@@ -92,7 +92,7 @@ if source_radio == "VIDEO":
|
|
| 92 |
if source_radio == "WEBCAM":
|
| 93 |
input = camera_input_live()
|
| 94 |
uploaded_image = Image.open(input)
|
| 95 |
-
uploaded_image_cv = cv2.cvtColor(
|
| 96 |
boxes, resized_image = utils.predict_image(uploaded_image_cv, conf_threshold)
|
| 97 |
visualized_image = utils.convert_result_to_image(uploaded_image_cv, resized_image, boxes, conf_labels=False)
|
| 98 |
st.image(visualized_image, channels = "RGB")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import utils
|
| 3 |
import cv2
|
| 4 |
+
import numpy as np
|
| 5 |
import io
|
| 6 |
import tempfile
|
| 7 |
from PIL import Image
|
|
|
|
| 28 |
input = st.sidebar.file_uploader("Choose an image.", type=("jpg", "png"))
|
| 29 |
if input is not None:
|
| 30 |
uploaded_image = Image.open(input)
|
| 31 |
+
uploaded_image_cv = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
|
| 32 |
boxes, resized_image = utils.predict_image(uploaded_image_cv, conf_threshold = conf_threshold)
|
| 33 |
result_image = utils.convert_result_to_image(uploaded_image_cv, resized_image, boxes, conf_labels=False)
|
| 34 |
st.image(result_image, channels = "RGB")
|
|
|
|
| 92 |
if source_radio == "WEBCAM":
|
| 93 |
input = camera_input_live()
|
| 94 |
uploaded_image = Image.open(input)
|
| 95 |
+
uploaded_image_cv = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
|
| 96 |
boxes, resized_image = utils.predict_image(uploaded_image_cv, conf_threshold)
|
| 97 |
visualized_image = utils.convert_result_to_image(uploaded_image_cv, resized_image, boxes, conf_labels=False)
|
| 98 |
st.image(visualized_image, channels = "RGB")
|