diff --git a/service_functions.py b/service_functions.py index 10f9754..a19f135 100644 --- a/service_functions.py +++ b/service_functions.py @@ -716,7 +716,7 @@ def convert_document_to_sentences_func(file_path: str, mime_type: str) -> Dict[s async def download_file(url: str, expected_size: int, expected_hash: str) -> str: temp_file = tempfile.NamedTemporaryFile(delete=False) temp_file_path = temp_file.name - hash_obj = hashlib.sha3_256() + hash_obj = sha3_256() downloaded_size = 0 async with httpx.AsyncClient() as client: async with client.stream("GET", url) as response: diff --git a/swiss_army_llama.py b/swiss_army_llama.py index 02dce1e..d7c86cf 100644 --- a/swiss_army_llama.py +++ b/swiss_army_llama.py @@ -19,7 +19,6 @@ import os import signal import re -import hashlib import tempfile import traceback import zipfile @@ -825,7 +824,7 @@ async def get_all_embedding_vectors_for_document( temp_file_path = await download_file(url, size, hash) else: raise HTTPException(status_code=400, detail="Invalid input. Provide either a file or URL with hash and size.") - hash_obj = hashlib.sha3_256() + hash_obj = sha3_256() with open(temp_file_path, 'rb') as buffer: for chunk in iter(lambda: buffer.read(chunk_size), b''): hash_obj.update(chunk)