File size: 763 Bytes
42c4f80
 
 
 
 
 
 
78f883e
 
 
42c4f80
 
78f883e
 
 
 
 
 
 
 
 
 
42c4f80
 
78f883e
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
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