chore: Start compression path
This commit is contained in:
parent
f32f4678e1
commit
9dff723bba
4 changed files with 147 additions and 94 deletions
23
src/process.py
Normal file
23
src/process.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import torch
|
||||
|
||||
|
||||
def compress(
|
||||
input_file: str | None = None
|
||||
):
|
||||
if input_file:
|
||||
with open(input_file, "rb") as file:
|
||||
byte_data = file.read()
|
||||
else:
|
||||
# Read from stdin
|
||||
text = input()
|
||||
byte_data = text.encode('utf-8', errors='replace')
|
||||
|
||||
tensor = torch.tensor(list(byte_data), dtype=torch.long)
|
||||
print(tensor)
|
||||
|
||||
# TODO Feed to model for compression, store result
|
||||
return
|
||||
|
||||
|
||||
def decompress():
|
||||
return NotImplementedError("Decompression is not implemented yet")
|
||||
Reference in a new issue