Skip to content

Commit

Permalink
add port
Browse files Browse the repository at this point in the history
  • Loading branch information
atharvakale343 committed Oct 17, 2024
1 parent 7532ebe commit 8f5a377
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion small_blk_forensics/backend/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from logging import Logger
import os
from pathlib import Path

from flask import Response
Expand Down Expand Up @@ -126,8 +127,9 @@ def execute(inputs: list[CustomInput], parameters: dict):
),
)
except Exception as e:
logger.error('An error occurred while executing the model')
logger.error(e)
return ErrorResponseModel(errors=[f"Server Error: {str(e)}"]).get_response(500)


server.run()
server.run(port=os.environ.get('FLASK_RUN_PORT') or 5000)
2 changes: 1 addition & 1 deletion small_blk_forensics/ml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _hash_directory(self, directory: Path, db_conn: sqlite3.Connection, out_path
"""
print(f"INFO: Hashing all files in {str(directory)}")
for file_path in tqdm(directory.rglob("*"), desc=" Hash Progress: ", disable=IS_TEST_MODE):
if file_path.is_file():
if file_path.is_file() and file_path.name != '.DS_Store':
self._hash_all_blocks_in_file(file_path, db_conn)
print(f"INFO: Successfully processed {str(directory)}")
print(f"INFO: Stored hashes at {out_path}")
Expand Down

0 comments on commit 8f5a377

Please sign in to comment.