Spaces:
Sleeping
Sleeping
import streamlit as st | |
from Face_Censoring import censor_face | |
import tempfile | |
#UIApp starts here | |
st.set_page_config(page_title="Python - Face Censoring", page_icon=":face_in_clouds:") | |
st.header("Python - Face Censoring") | |
uploaded_file = st.file_uploader("Choose a video (only with 'mp4' extension): ", accept_multiple_files=False, type=['mp4']) | |
if uploaded_file is not None: | |
tfile = tempfile.NamedTemporaryFile(delete=False) | |
tfile.write(uploaded_file.read()) | |
video_file = open(tfile.name, 'rb') | |
video_bytes = video_file.read() | |
st.video(video_bytes) | |
#tfile2 = tempfile.NamedTemporaryFile(delete=False) | |
#tfile2.write(output) | |
output=censor_face(tfile) | |
result_video = open(output.name, "rb") | |
vid_bytes = result_video.read() | |
#with open(tfile2.name, "rb") as file: | |
# btn = st.download_button( | |
# label="Download video", | |
# data=file, | |
# file_name=tfile2.name, | |
# mime="video/mp4" | |
# ) | |
#video_file = open(tfile2.name, 'rb') | |
#video_bytes = video_file.read() | |
st.video(vid_bytes) | |