File size: 1,120 Bytes
1394dfd
d18b950
08a4635
1394dfd
 
8dc0a71
1394dfd
 
545a7e1
 
08a4635
 
 
6a40d06
08a4635
c3a2437
 
 
1394dfd
6a40d06
 
 
9416475
a1b641b
6a40d06
 
 
 
 
 
 
8dc0a71
6a40d06
 
9416475
545a7e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)