Skip to content
Open

Api #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions model.h5:Zone.Identifier
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://drive.google.com/
HostUrl=https://drive.usercontent.google.com/download?id=1rTVJGaQwKP2SuB1lp0F9zUVha59J0x6o&export=download&authuser=0
10 changes: 2 additions & 8 deletions treasurebot/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from treasurebot.ml_logic.registry import get_model
from treasurebot.ml_logic.preprocessor import preprocess_image
from treasurebot.ml_logic.data import get_picture
import os


# Load environment variables

Expand All @@ -15,12 +13,8 @@

@app.get("/classify")
async def classify_image():
# Get the directory of the current script
current_dir = os.path.dirname(__file__)
# moving to the root directory
parent_dir = os.path.abspath(os.path.join(current_dir, '..', '..'))
# Construct the path to the 'test.jpg' file
image_path = os.path.join(parent_dir, 'pictures', 'test.jpg')
# Open the image from the upload
image = get_picture('test.jpg')

# Preprocess the image using the defined function
preprocessed_image = preprocess_image(image_path)
Expand Down
1 change: 1 addition & 0 deletions treasurebot/ml_logic/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from treasurebot.params import *
from tensorflow.keras.models import load_model


def get_model():
#if MODEL_TARGET == 'local':
current_dir = os.path.dirname(__file__)
Expand Down