Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /rpidhe_chainlit-pypi /cypress /e2e /file_element /main.py
| import os | |
| import chainlit as cl | |
| # Get the directory where the current script is located | |
| current_directory = os.path.dirname(os.path.abspath(__file__)) | |
| # Construct the absolute path to the fixtures directory (two levels up from current_dir) | |
| fixtures_directory = os.path.abspath( | |
| os.path.join(current_directory, "..", "..", "fixtures") | |
| ) | |
| # Construct absolute paths for each file | |
| mp4_path = os.path.join(fixtures_directory, "example.mp4") | |
| jpeg_path = os.path.join(fixtures_directory, "cat.jpeg") | |
| python_file_path = os.path.join(fixtures_directory, "hello.py") | |
| mp3_path = os.path.join(fixtures_directory, "example.mp3") | |
| async def start(): | |
| elements = [ | |
| cl.File( | |
| name="example.mp4", | |
| path=mp4_path, | |
| mime="video/mp4", | |
| ), | |
| cl.File( | |
| name="cat.jpeg", | |
| path=jpeg_path, | |
| mime="image/jpg", | |
| ), | |
| cl.File( | |
| name="hello.py", | |
| path=python_file_path, | |
| mime="plain/py", | |
| ), | |
| cl.File( | |
| name="example.mp3", | |
| path=mp3_path, | |
| mime="audio/mp3", | |
| ), | |
| ] | |
| await cl.Message( | |
| content="This message has a couple of file element", elements=elements | |
| ).send() | |
Xet Storage Details
- Size:
- 1.27 kB
- Xet hash:
- d85e149200aeb28ab25b4873836439a8341b31b70ca9a2aa848693cc38df93af
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.