Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,36 +4,52 @@ import subprocess
|
|
| 4 |
import os
|
| 5 |
import re
|
| 6 |
|
| 7 |
-
# Page settings
|
| 8 |
st.set_page_config(page_title="Video Speed Tool", layout="centered")
|
| 9 |
|
| 10 |
-
# CSS for mobile
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
| 13 |
-
/* Center title
|
| 14 |
.title-center {
|
| 15 |
text-align: center;
|
| 16 |
font-size: 1.8em;
|
| 17 |
font-weight: bold;
|
|
|
|
| 18 |
}
|
| 19 |
-
/*
|
| 20 |
div.stButton > button {
|
| 21 |
font-weight: bold;
|
| 22 |
-
width:
|
| 23 |
border-radius: 8px;
|
| 24 |
padding: 10px 0;
|
| 25 |
font-size: 1.1em;
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
-
/* Center
|
| 28 |
-
.
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
</style>
|
| 33 |
""", unsafe_allow_html=True)
|
| 34 |
|
|
|
|
| 35 |
st.markdown('<p class="title-center">🎬 Video Speed Tool</p>', unsafe_allow_html=True)
|
| 36 |
|
|
|
|
| 37 |
uploaded_file = st.file_uploader("Upload video", type=["mp4", "mov", "avi", "mkv"])
|
| 38 |
|
| 39 |
# Speed input
|
|
@@ -48,7 +64,6 @@ speed = st.number_input(
|
|
| 48 |
if uploaded_file is not None:
|
| 49 |
st.video(uploaded_file)
|
| 50 |
|
| 51 |
-
# Center button
|
| 52 |
if st.button("PROCESS VIDEO"):
|
| 53 |
with st.spinner("Processing... Please wait"):
|
| 54 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmp_input:
|
|
@@ -105,19 +120,7 @@ if uploaded_file is not None:
|
|
| 105 |
# Show processed video
|
| 106 |
st.video(output_path)
|
| 107 |
|
| 108 |
-
#
|
| 109 |
-
st.markdown("""
|
| 110 |
-
<style>
|
| 111 |
-
.stDownloadButton button {
|
| 112 |
-
font-weight: bold;
|
| 113 |
-
width: 100%;
|
| 114 |
-
border-radius: 8px;
|
| 115 |
-
padding: 10px 0;
|
| 116 |
-
font-size: 1.1em;
|
| 117 |
-
}
|
| 118 |
-
</style>
|
| 119 |
-
""", unsafe_allow_html=True)
|
| 120 |
-
|
| 121 |
with open(output_path, "rb") as f:
|
| 122 |
st.download_button(
|
| 123 |
label="DOWNLOAD VIDEO",
|
|
|
|
| 4 |
import os
|
| 5 |
import re
|
| 6 |
|
| 7 |
+
# Page settings
|
| 8 |
st.set_page_config(page_title="Video Speed Tool", layout="centered")
|
| 9 |
|
| 10 |
+
# CSS styling for mobile
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
| 13 |
+
/* Center title */
|
| 14 |
.title-center {
|
| 15 |
text-align: center;
|
| 16 |
font-size: 1.8em;
|
| 17 |
font-weight: bold;
|
| 18 |
+
margin-bottom: 20px;
|
| 19 |
}
|
| 20 |
+
/* Center all buttons */
|
| 21 |
div.stButton > button {
|
| 22 |
font-weight: bold;
|
| 23 |
+
width: 80%;
|
| 24 |
border-radius: 8px;
|
| 25 |
padding: 10px 0;
|
| 26 |
font-size: 1.1em;
|
| 27 |
+
display: block;
|
| 28 |
+
margin: 0 auto;
|
| 29 |
}
|
| 30 |
+
/* Center download button */
|
| 31 |
+
div.stDownloadButton > button {
|
| 32 |
+
font-weight: bold;
|
| 33 |
+
width: 80%;
|
| 34 |
+
border-radius: 8px;
|
| 35 |
+
padding: 10px 0;
|
| 36 |
+
font-size: 1.1em;
|
| 37 |
+
display: block;
|
| 38 |
+
margin: 0 auto;
|
| 39 |
+
}
|
| 40 |
+
/* Bigger + and - buttons in number input */
|
| 41 |
+
div[data-baseweb="input"] button {
|
| 42 |
+
width: 40px !important;
|
| 43 |
+
height: 40px !important;
|
| 44 |
+
font-size: 1.2em !important;
|
| 45 |
}
|
| 46 |
</style>
|
| 47 |
""", unsafe_allow_html=True)
|
| 48 |
|
| 49 |
+
# Title
|
| 50 |
st.markdown('<p class="title-center">🎬 Video Speed Tool</p>', unsafe_allow_html=True)
|
| 51 |
|
| 52 |
+
# Upload file
|
| 53 |
uploaded_file = st.file_uploader("Upload video", type=["mp4", "mov", "avi", "mkv"])
|
| 54 |
|
| 55 |
# Speed input
|
|
|
|
| 64 |
if uploaded_file is not None:
|
| 65 |
st.video(uploaded_file)
|
| 66 |
|
|
|
|
| 67 |
if st.button("PROCESS VIDEO"):
|
| 68 |
with st.spinner("Processing... Please wait"):
|
| 69 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmp_input:
|
|
|
|
| 120 |
# Show processed video
|
| 121 |
st.video(output_path)
|
| 122 |
|
| 123 |
+
# Download button centered
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
with open(output_path, "rb") as f:
|
| 125 |
st.download_button(
|
| 126 |
label="DOWNLOAD VIDEO",
|