Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,24 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import os
|
3 |
|
4 |
+
st.title("Video Playback and Duplication")
|
5 |
+
|
6 |
+
# Загрузка видеофайла
|
7 |
+
uploaded_file = st.file_uploader("Choose a video...", type=["mp4", "avi", "mov", "mkv"])
|
8 |
+
|
9 |
+
if uploaded_file is not None:
|
10 |
+
# Создаем временную директорию для сохранения загруженного видео
|
11 |
+
os.makedirs("temp", exist_ok=True)
|
12 |
+
input_video_path = os.path.join("temp", uploaded_file.name)
|
13 |
+
|
14 |
+
# Сохраняем загруженное видео на диск
|
15 |
+
with open(input_video_path, "wb") as f:
|
16 |
+
f.write(uploaded_file.getbuffer())
|
17 |
+
|
18 |
+
# Воспроизведение загруженного видео
|
19 |
+
st.video(input_video_path, start_time=0)
|
20 |
+
st.write("Original Video")
|
21 |
+
|
22 |
+
# Дублирование и воспроизведение видео
|
23 |
+
st.video(input_video_path, start_time=0)
|
24 |
+
st.write("Duplicated Video")
|