File size: 646 Bytes
8d5f133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st


def video_input() -> [str, st.container, st.container]:
    """

    :return: путь к файлу
    """

    st.title("Video Input")
    video_file = st.file_uploader("Upload a video", type=["mp4"])

    if video_file is None:
        st.stop()

    _, video_container, message_container, _ = st.columns([1, 2, 2, 1])
    video_container: st.empty()

    if video_file is not None:
        video_container.video(video_file)

    file_path = f'./{abs(hash(str(video_file)))}.mp4'

    with open(file_path, 'wb') as file:
        file.write(video_file.read())

    return file_path, video_container, message_container