Buckets:

download
raw
891 Bytes
import aiofiles
import chainlit as cl
@cl.on_chat_start
async def start():
files = await cl.AskFileMessage(
content="Please upload a text file to begin!", accept=["text/plain"]
).send()
txt_file = files[0]
async with aiofiles.open(txt_file.path, "r", encoding="utf-8") as f:
content = await f.read()
await cl.Message(
content=f"`Text file {txt_file.name}` uploaded, it contains {len(content)} characters!"
).send()
files = await cl.AskFileMessage(
content="Please upload a python file to begin!", accept={"text/plain": [".py"]}
).send()
py_file = files[0]
async with aiofiles.open(py_file.path, "r", encoding="utf-8") as f:
content = await f.read()
await cl.Message(
content=f"`Python file {py_file.name}` uploaded, it contains {len(content)} characters!"
).send()

Xet Storage Details

Size:
891 Bytes
·
Xet hash:
275a1d5773c4d111f7de9a4d8e93a4dd5dfa4d736383fe9e09534f1973269560

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.