tiktokApp / video_input.py
vktrbr's picture
test
8d5f133
raw
history blame contribute delete
No virus
646 Bytes
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