From aed62fd26e2a4153b7710c127073f31b3f346143 Mon Sep 17 00:00:00 2001 From: ueta-eisuke Date: Sat, 19 Dec 2020 18:36:03 +0900 Subject: [PATCH] add url logging --- README.md | 17 +++++++++-------- fastlabel/__init__.py | 7 +++++-- setup.py | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b5cab85..9f49e3d 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,11 @@ ## Installation ```bash -$ pip install fastlabel +$ pip install --upgrade fastlabel ``` +> Python version 3.8 or greater is required + ## Usage Configure API Key in environment variable. @@ -27,18 +29,17 @@ client = fastlabel.Client() ```python import fastlabel -from fastlabel.const import AnalysisType # Initialize client client = fastlabel.Client() # Create predictions -const predictions = [ +predictions = [ { - fileKey="sample1.jpg", # file name exists in project - labels=[ + "fileKey": "sample1.jpg", # file name exists in your project + "labels": [ { - "value": "line_a", # class value exists in project + "value": "line_a", # class value exists in your project "points": [ { "x": 10, "y": 10 }, { "x": 20, "y": 20 }, @@ -58,8 +59,8 @@ const predictions = [ # Upload predictions client.upload_predictions( project_id="project_id", # your fastlabel project id - analysis_type=AnalysisType.line, # annotation type to be analyze - threshold=20, # IoU percentage/pixel to analyze labels. (Ex: 0 - 100) + analysis_type="line", # annotation type to be analyze ("bbox" or "line" are supported) + threshold=25, # IoU percentage/pixel to analyze labels. (Ex: 0 - 100) predictions=predictions ) ``` diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index f657081..e734d29 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -1,8 +1,11 @@ -import logging import os import requests +from logging import getLogger from fastlabel.const import AnalysisType +logger = getLogger(__name__) + +APP_BASE_URL = "https://app.fastlabel.ai/projects/" FASTLABEL_ENDPOINT = "https://api-fastlabel-production.web.app/api/v1/" class Client: @@ -74,7 +77,7 @@ def upload_predictions(self, project_id: str, analysis_type: AnalysisType, thres "predictions": predictions } self._postrequest(endpoint, payload=payload) - logging.info("") + logger.warn("Successfully uploaded! See " + APP_BASE_URL + project_id + "/modelAnalysis") class FastLabelException(Exception): diff --git a/setup.py b/setup.py index 2141b78..0aefc90 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name="fastlabel", - version="0.1.0", + version="0.1.1", author="eisuke-ueta", author_email="eisuke.ueta@fastlabel.ai", description="The official Python SDK for FastLabel API, the Data Platform for AI",