Update app.py
Browse files
app.py
CHANGED
|
@@ -9,23 +9,23 @@ import moviepy.editor as mpy
|
|
| 9 |
from camera_input_live import camera_input_live
|
| 10 |
|
| 11 |
st.set_page_config(
|
| 12 |
-
page_title="
|
| 13 |
page_icon=":sun_with_face:",
|
| 14 |
layout="centered",
|
| 15 |
initial_sidebar_state="expanded",)
|
| 16 |
|
| 17 |
-
st.title("
|
| 18 |
|
| 19 |
-
st.sidebar.header("
|
| 20 |
-
source_radio = st.sidebar.radio("
|
| 21 |
|
| 22 |
-
st.sidebar.header("
|
| 23 |
-
conf_threshold = float(st.sidebar.slider("
|
| 24 |
|
| 25 |
input = None
|
| 26 |
if source_radio == "IMAGE":
|
| 27 |
-
st.sidebar.header("
|
| 28 |
-
input = st.sidebar.file_uploader("
|
| 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)
|
|
@@ -55,26 +55,7 @@ def play_video(video_source):
|
|
| 55 |
visualized_image = utils.convert_result_to_image(frame, resized_image, boxes, conf_labels=False)
|
| 56 |
except:
|
| 57 |
visualized_image = frame
|
| 58 |
-
st_frame
|
| 59 |
-
video_row.append(cv2.cvtColor(visualized_image,cv2.COLOR_BGR2RGB))
|
| 60 |
-
frame_count +=1
|
| 61 |
-
progress_bar.progress(frame_count/total_frames, text=None)
|
| 62 |
-
|
| 63 |
-
else:
|
| 64 |
-
progress_bar.empty()
|
| 65 |
-
camera.release()
|
| 66 |
-
st_frame.empty()
|
| 67 |
-
break
|
| 68 |
-
clip = mpy.ImageSequenceClip(video_row, fps = fps)
|
| 69 |
-
clip.write_videofile(temp_file_2.name)
|
| 70 |
-
st.video(temp_file_2.name)
|
| 71 |
-
|
| 72 |
-
# νμΌ μ
λ‘λ μ²λ¦¬
|
| 73 |
-
temporary_location = None
|
| 74 |
-
|
| 75 |
-
if source_radio == "VIDEO":
|
| 76 |
-
st.sidebar.header("Upload")
|
| 77 |
-
input_file = st.sidebar.file_uploader("Choose a video.", type=("mp4"))
|
| 78 |
if input_file is not None:
|
| 79 |
# νμΌμ μμ κ²½λ‘μ μ μ₯
|
| 80 |
g = io.BytesIO(input_file.read())
|
|
|
|
| 9 |
from camera_input_live import camera_input_live
|
| 10 |
|
| 11 |
st.set_page_config(
|
| 12 |
+
page_title="κΈμ μΈμ AI μμ€ν
",
|
| 13 |
page_icon=":sun_with_face:",
|
| 14 |
layout="centered",
|
| 15 |
initial_sidebar_state="expanded",)
|
| 16 |
|
| 17 |
+
st.title("κΈμ μΈμ AI μμ€ν
:sun_with_face:")
|
| 18 |
|
| 19 |
+
st.sidebar.header("λ©λ΄")
|
| 20 |
+
source_radio = st.sidebar.radio("μ ννμΈμ", ["IMAGE", "VIDEO", "WEBCAM"])
|
| 21 |
|
| 22 |
+
st.sidebar.header("μ λ’°λ")
|
| 23 |
+
conf_threshold = float(st.sidebar.slider("μ λ’°λ μκ³κ°μ μ ννμΈμ", 10, 100, 20))/100
|
| 24 |
|
| 25 |
input = None
|
| 26 |
if source_radio == "IMAGE":
|
| 27 |
+
st.sidebar.header("μ΄λ―Έμ§ νμΌ μ
λ‘λ")
|
| 28 |
+
input = st.sidebar.file_uploader("μ΄λ―Έμ§ νμΌμ μ ννμΈμ", 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)
|
|
|
|
| 55 |
visualized_image = utils.convert_result_to_image(frame, resized_image, boxes, conf_labels=False)
|
| 56 |
except:
|
| 57 |
visualized_image = frame
|
| 58 |
+
st_frameμ", type=("mp4"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
if input_file is not None:
|
| 60 |
# νμΌμ μμ κ²½λ‘μ μ μ₯
|
| 61 |
g = io.BytesIO(input_file.read())
|