Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,13 +49,16 @@ class CustomTheme(Base):
|
|
49 |
|
50 |
custom_theme = CustomTheme()
|
51 |
|
52 |
-
|
53 |
-
|
|
|
54 |
upload_dir = "uploaded_videos"
|
55 |
os.makedirs(upload_dir, exist_ok=True)
|
56 |
-
|
|
|
|
|
57 |
with open(file_path, "wb") as f:
|
58 |
-
f.write(
|
59 |
return file_path
|
60 |
|
61 |
def display_results(video_file):
|
|
|
49 |
|
50 |
custom_theme = CustomTheme()
|
51 |
|
52 |
+
from datetime import datetime
|
53 |
+
|
54 |
+
def save_uploaded_file(uploaded_bytes):
|
55 |
upload_dir = "uploaded_videos"
|
56 |
os.makedirs(upload_dir, exist_ok=True)
|
57 |
+
# Generate a unique filename using timestamp to avoid overwriting files
|
58 |
+
file_name = f"uploaded_video_{datetime.now().strftime('%Y%m%d%H%M%S')}.mp4"
|
59 |
+
file_path = os.path.join(upload_dir, file_name)
|
60 |
with open(file_path, "wb") as f:
|
61 |
+
f.write(uploaded_bytes)
|
62 |
return file_path
|
63 |
|
64 |
def display_results(video_file):
|