Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dicklesworthstone committed May 20, 2024
1 parent 9b0b584 commit 5b36699
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion service_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions swiss_army_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import os
import signal
import re
import hashlib
import tempfile
import traceback
import zipfile
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5b36699

Please sign in to comment.