Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from utils import object_detection_brainai as odb | |
| object_detection = odb.ObjectDetectionModel() | |
| st.set_page_config( | |
| page_title = "κ°μ²΄ μΈμ", | |
| page_icon = ":black_cat:", | |
| layout = "wide") | |
| st.title(":blue[Object Detection] :black_cat:") | |
| st.sidebar.header("λ©λ΄") | |
| source_radio = st.sidebar.radio("μ ννμΈμ", ["IMAGE", "VIDEO", "GAME", "WEBCAM"]) | |
| if source_radio == "IMAGE": | |
| st.write(":green[μΌμͺ½ λ©λ΄ 'Browse files' λ²νΌμ ν΄λ¦νμ¬ μ΄λ―Έμ§ νμΌμ μ ννλ©΄ AI μΆλ‘ μ΄ μμλ©λλ€.]") | |
| st.sidebar.header("μ΄λ―Έμ§ νμΌ μ λ‘λ") | |
| input_img = st.sidebar.file_uploader("μ΄λ―Έμ§ νμΌμ μ ννμΈμ.", type=("jpg", "png")) | |
| if input_img is not None: | |
| result_img, detected_object = object_detection.process(input_img) | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.image(result_img) | |
| with col2: | |
| st.header(detected_object) | |
| else: | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.image("data/table.jpg") | |
| with col2: | |
| st.header("Objected detected: chair, potted plant, vase, dining table") | |
| if source_radio == "VIDEO": | |
| st.write(":green[μΌμͺ½ λ©λ΄ 'Browse files' λ²νΌμ ν΄λ¦νμ¬ λΉλμ€ νμΌμ μ ννλ©΄ AI μΆλ‘ μ΄ μμλ©λλ€.]") | |
| st.sidebar.header("λΉλμ€ νμΌ μ λ‘λ") | |
| input_video = st.sidebar.file_uploader("λΉλμ€ νμΌμ μ ννμΈμ.", type=("mp4")) | |
| if input_video is not None: | |
| output_video_path = object_detection.play_video(input_video) | |
| st.video(output_video_path) | |
| else: | |
| st.video("data/breakfast.mp4") | |