OCEANAI / app /event_handlers /examples_blocks.py
ElenaRyumina's picture
v0.8.3 (#11)
78f883e verified
raw
history blame
No virus
763 Bytes
"""
File: examples_blocks.py
Author: Elena Ryumina and Dmitry Ryumin
Description: Event handler for the addition of examples to the Gradio app.
License: MIT License
"""
import re
from pathlib import Path
# Importing necessary components for the Gradio app
# import hashlib
# import time
# for _ in range(6):
# current_time = time.time()
# time_bytes = str(current_time).encode("utf-8")
# hash_object = hashlib.sha256(time_bytes)
# hex_digest = hash_object.hexdigest()
# print(hex_digest[:15])
def event_handler_examples_blocks():
videos_dir = Path("videos")
video_files = sorted(
(str(p) for p in videos_dir.glob("*.mp4")),
key=lambda x: int(re.search(r"\d+", Path(x).stem).group()),
)
return video_files