aashwinik's picture
Update app.py
c3a2437 verified
raw history blame
No virus
892 Bytes
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())
output=censor_face(tfile)
video_file = open(tfile.name, 'rb')
video_bytes = video_file.read()
st.video(video_bytes)
with open(output, "rb") as file:
btn = st.download_button(
label="Download video",
data=file,
file_name=output,
mime="video/mp4"
)
video_file = open(output, 'rb')
video_bytes = video_file.read()
st.video(video_bytes)