Skip to content

Commit

Permalink
Release/1.1.0 (#1093)
Browse files Browse the repository at this point in the history
* Update LSF (OCR, performance)

* Update DM

* Expand tasks size. Remove tag. Move moto to requirements-test.txt (#1020)

* Expand tasks size

* Move moto to requirements-test.txt

* Relax django-ranged-fileresponse requirements

* Create annotation_ids.md (#1078)

Adding result ID info to labeling and export docs

* Update requirements-test.txt

Co-authored-by: smoreface <smoreface@users.noreply.github.com>

* Changing requirement for label-studio-converter

* Fixing commit for label-studio-converter

* Changing requirements for label-studio-converter last commit in master

* Fix deployment & OCR config

* Update lsf

* Fix/move storage list as a settings (#1099)

* Move storage list as a settings function

* Add missed module

Co-authored-by: nik <nik@heartex.net>

* Add form layout post processing

* Update editor

* Error tracking (#1107)

* Add Sentry

* Sentry setup

* Add versions to base.html

* Integrate Sentry with React Router

* Extended sentry tracking

Co-authored-by: makseq-ubnt <makseq@gmail.com>

* Fix view auth check (#1075)

* Increase test coverage for common.py

* Change version

* Put correct annotator username into drafts

* Fix space before username in draft

* Remove json block from settings template

* Fix common columns reset after task deletion

* Fix postgres tests

* Remove excess test

* Update frontend

* Fix get-build error; switch lsf to master

* Update frontend

* Update converter version. Decrease sentry rate

* Replace template image

* Update frontend

* Update frontend

* Update release version

* Update template image

* Change version to 1.1.0

Co-authored-by: Nikita Skryabin <nr@fenelon.ru>
Co-authored-by: nik <nik@heartex.net>
Co-authored-by: Max Tkachenko <makseq@gmail.com>
Co-authored-by: smoreface <smoreface@users.noreply.github.com>
Co-authored-by: KonstantinKorotaev <konstantin@heartex.com>
Co-authored-by: Koshevarov Sergey <koshevarov.sergey@gmail.com>
Co-authored-by: Nick Skriabin <767890+nicholasrq@users.noreply.github.com>
Co-authored-by: Sergei Ivashchenko <triklozoid@gmail.com>
Co-authored-by: hlomzik <hlomzik@gmail.com>
  • Loading branch information
10 people committed Jun 30, 2021
1 parent fd235f2 commit e3431c8
Show file tree
Hide file tree
Showing 37 changed files with 186 additions and 271 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Expand Up @@ -3,16 +3,16 @@ FROM ubuntu:20.04

WORKDIR /label-studio

# Copy and install requirements.txt first for caching
COPY deploy/requirements.txt /label-studio

ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y build-essential postgresql-client python3.8 python3-pip python3.8-dev uwsgi git libxml2-dev libxslt-dev zlib1g-dev uwsgi

RUN chgrp -R 0 /var/log /var/cache /var/run /run /tmp /etc/uwsgi && \
chmod -R g+rwX /var/log /var/cache /var/run /run /tmp /etc/uwsgi

# Copy and install requirements.txt first for caching
COPY deploy/requirements.txt /label-studio

RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt && pip install uwsgi

Expand Down
2 changes: 1 addition & 1 deletion deploy/requirements-test.txt
Expand Up @@ -6,4 +6,4 @@ requests-mock==1.5.2
pyyaml>=5.3.1
moto==1.3.16.dev122
tavern==1.14.0
fakeredis==1.5.0
fakeredis==1.5.0
5 changes: 2 additions & 3 deletions deploy/requirements.txt
Expand Up @@ -18,17 +18,16 @@ django-cors-headers==3.6.0
django-extensions==3.1.0
django-rest-swagger==2.2.0
django-user-agents==0.4.0
django-ranged-fileresponse==0.1.2
django-ranged-fileresponse>=0.1.2
django-redis-cache==3.0.0
drf_dynamic_fields==0.3.0
drf_yasg==1.20.0
drf-generators==0.3.0
label-studio-converter==0.0.28
label-studio-converter==0.0.29
htmlmin==0.1.12
jsonschema==3.2.0
lockfile>=0.12.0
lxml>=4.2.5
moto==1.3.16.dev122
numpy>=1.19.1
ordered_set==4.0.2
pandas>=0.24.0
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Expand Up @@ -30,7 +30,7 @@ services:
- POSTGRE_PASSWORD=
- POSTGRE_PORT=5432
- POSTGRE_HOST=db
- LABEL_STUDIO_HOST=${LABEL_STUDIO_HOST:-""}
- LABEL_STUDIO_HOST=${LABEL_STUDIO_HOST:-}
volumes:
- ./mydata:/label-studio/data:rw
- static:/label-studio/label_studio:rw
Expand Down
2 changes: 1 addition & 1 deletion label_studio/__init__.py
Expand Up @@ -4,7 +4,7 @@
package_name = 'label-studio'

# Package version
__version__ = '1.0.2'
__version__ = '1.1.0'

# pypi info
__latest_version__ = None
Expand Down
Expand Up @@ -2,26 +2,27 @@ title: Optical Character Recognition
type: community
group: Computer Vision
image: /static/templates/optical-character-recognition.png
details: <h1>Draw a bounding box around region and write down the text found inside</h1>
details: <h1>Draw a bounding box or polygon around region and write down the text found inside</h1>
config: '
<View>
<Image name="image" value="$ocr"/>
<RectangleLabels name="label" toName="image">
<Labels name="label" toName="image">
<Label value="Text" background="green"/>
<Label value="Handwriting" background="blue"/>
</RectangleLabels>
</Labels>
<View visibleWhen="region-selected" style="width: 100%; display: block">
<Header value="Write transcription:" />
<TextArea name="transcription" toName="image"
editable="true"
perRegion="true"
required="true"
maxSubmissions="1"
rows="5"
/>
</View>
<Rectangle name="bbox" toName="image" strokeWidth="3"/>
<Polygon name="poly" toName="image" strokeWidth="3"/>
<TextArea name="transcription" toName="image"
editable="true"
perRegion="true"
required="true"
maxSubmissions="1"
rows="5"
placeholder="Recognized Text"
displayMode="region-list"
/>
</View>
'
69 changes: 0 additions & 69 deletions label_studio/core/permissions.py
Expand Up @@ -173,72 +173,3 @@ def has_object_permission(self, request, view, obj):
return True

return False


""" Helpers """


def view_with_auth(http_method_names, permission_names):
""" Decorator combining require_http_methods and check_auth into one line
:param http_method_names: http methods ['GET', 'POST', ...]
:param permission_names: DRF auth classes [IsAuthenticated, IsBusiness, ...]
:return: wrapped into decorator function
"""

def check_auth(func):
""" Check authentication based on DRF permission classes (IsAuthenticated, IsBusiness, etc)
"""
def wrapper(request, *args, **kwargs):
checks = [name().has_permission(request, None) for name in permission_names]
# auth is ok
if any(checks):
return func(request, *args, **kwargs)
# auth is bad
else:
redirect_name = 'expert-login' if request.path.startswith('/expert') else 'user-login'
redirect_path = reverse(redirect_name) + '?next=' + request.path
return raise_auth_denied('Authentication credentials were not provided', request, redirect_path)

return wrapper

def decorator(func):
check_methods = require_http_methods(http_method_names)
func = check_auth(func)
func = check_methods(func)
return func

return decorator


def check_permissions(request, obj, permission_class):
approved = permission_class().has_object_permission(request, None, obj)
if not approved:
raise_auth_denied('Access denied', request)
return True


def check_object_permissions(request, obj, permission_name):
if request.user.has_perm(permission_name, obj):
return True
raise_auth_denied('Access denied', request)


def get_object_with_permissions(request, class_name, pk, permission_name):
assert isinstance(permission_name, str)
obj = get_object_with_check_and_log(request, class_name, pk=pk)
check_object_permissions(request, obj, permission_name)
return obj


def raise_auth_denied(msg, request, redirect_path=''):
# HTML request
if 'text/html' in request.META.get('HTTP_ACCEPT', 'text/html'):
if redirect_path:
return redirect(redirect_path)
else:
raise HTMLPermissionDenied(msg)

# DRF request
else:
raise DRFPermissionDenied(msg)
7 changes: 4 additions & 3 deletions label_studio/core/settings/base.py
Expand Up @@ -266,7 +266,7 @@
}

SENTRY_DSN = get_env('SENTRY_DSN', None)
SENTRY_RATE = float(get_env('SENTRY_RATE', 1.0))
SENTRY_RATE = float(get_env('SENTRY_RATE', 0.25))
SENTRY_ENVIRONMENT = get_env('SENTRY_ENVIRONMENT', 'stage.opensource')
SENTRY_REDIS_ENABLED = False

Expand Down Expand Up @@ -314,8 +314,8 @@
os.makedirs(EXPORT_DIR, exist_ok=True)

# file / task size limits
DATA_UPLOAD_MAX_MEMORY_SIZE = int(get_env('DATA_UPLOAD_MAX_MEMORY_SIZE', 50 * 1024 * 1024))
TASKS_MAX_NUMBER = 250000
DATA_UPLOAD_MAX_MEMORY_SIZE = int(get_env('DATA_UPLOAD_MAX_MEMORY_SIZE', 250 * 1024 * 1024))
TASKS_MAX_NUMBER = 1000000
TASKS_MAX_FILE_SIZE = DATA_UPLOAD_MAX_MEMORY_SIZE

TASK_LOCK_TTL = int(get_env('TASK_LOCK_TTL')) if get_env('TASK_LOCK_TTL') else None
Expand Down Expand Up @@ -362,6 +362,7 @@
ANNOTATION_MIXIN = 'core.mixins.DummyModelMixin'
ORGANIZATION_MIXIN = 'core.mixins.DummyModelMixin'
USER_MIXIN = 'users.mixins.UserMixin'
GET_STORAGE_LIST = 'io_storages.functions.get_storage_list'


def project_delete(project):
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 0 additions & 39 deletions label_studio/core/utils/common.py
Expand Up @@ -126,31 +126,6 @@ def create_hash():
return h.hexdigest()[0:16]


def pretty_date(t):
# check version is datetime
is_timestamp = True
if isinstance(t, datetime):
t = str(int(t.timestamp()))

# check if version is correct timestamp from string
else:
try:
int(t)
except (ValueError, TypeError):
is_timestamp = False
else:
if datetime.fromtimestamp(int(t)) < datetime(1990, 1, 1):
is_timestamp = False

# pretty format if timestamp else print version as is
if is_timestamp:
timestamp = int(t)
dt = datetime.fromtimestamp(timestamp)
return dt.strftime(f'%d %b %Y %H:%M:%S.{str(t)[-3:]}')
else:
return t


def paginator(objects, request, default_page=1, default_size=50):
""" Get from request page and page_size and return paginated objects
Expand Down Expand Up @@ -217,20 +192,6 @@ def string_is_url(url):
return True


def download_base64_uri(url, username, password):
try:
if username is not None and password is not None:
r = requests.get(url, auth=HTTPBasicAuth(username, password))
else:
r = requests.get(url)
r.raise_for_status()
except requests.exceptions.RequestException as e:
logger.error(f'Failed downloading {url}. Reason: {e}', exc_info=True)
else:
encoded_uri = b64encode(r.content).decode('utf-8')
return f'data:{r.headers["Content-Type"]};base64,{encoded_uri}'


def safe_float(v, default=0):
if v != v:
return default
Expand Down
3 changes: 0 additions & 3 deletions label_studio/data_import/urls.py
Expand Up @@ -3,13 +3,10 @@
from django.urls import path, include

from . import api
from . import views


app_name = 'data_import'

_urlpatterns = []

_api_urlpatterns = [
path('file-upload/<int:pk>', api.FileUploadAPI.as_view(), name='file-upload-detail')
]
Expand Down
23 changes: 0 additions & 23 deletions label_studio/data_import/views.py

This file was deleted.

17 changes: 5 additions & 12 deletions label_studio/data_manager/views.py
@@ -1,23 +1,16 @@
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
from django.shortcuts import redirect, render, reverse
from rules.contrib.views import permission_required, objectgetter
from django.shortcuts import render
from django.contrib.auth.decorators import login_required

from core.permissions import (IsBusiness, get_object_with_permissions, view_with_auth)
from core.utils.common import get_object_with_check_and_log, find_editor_files, get_organization_from_request
from core.utils.common import find_editor_files
from core.version import get_short_version
from organizations.models import Organization
from projects.models import Project


@view_with_auth(['GET'], (IsBusiness,))
# @permission_required('tasks.delete_task', fn=objectgetter(Project, 'pk'), raise_exception=True)
@login_required
def task_page(request, pk):
project = get_object_with_check_and_log(request, Project, pk=pk)

response = {
'project': project,
'version': get_short_version()
}
response.update(find_editor_files())
return render(request, 'data_manager/data.html', response)
return render(request, 'base.html', response)
2 changes: 1 addition & 1 deletion label_studio/frontend/dist/dm/js/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion label_studio/frontend/dist/dm/js/main.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions label_studio/frontend/dist/dm/version.json
@@ -1,6 +1,6 @@
{
"message": "Support multiple images data",
"commit": "f182e3fb1bcb8de28dfca994c4f345a87e4d54b8",
"message": "Don't close QuickView by Enter",
"commit": "d12a691d1e941768c3067ccb15abe5498f8a453b",
"branch": "master",
"date": "2021-06-29T17:13:19Z"
"date": "2021-06-30T16:06:22Z"
}
2 changes: 1 addition & 1 deletion label_studio/frontend/dist/lsf/css/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion label_studio/frontend/dist/lsf/css/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion label_studio/frontend/dist/lsf/js/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion label_studio/frontend/dist/lsf/js/main.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions label_studio/frontend/dist/lsf/version.json
@@ -1,6 +1,6 @@
{
"message": "OCR improvements (#214)\n\n* Add sidebar displaying mode for per region textareas\r\n\r\n* Fix label tree groups\r\n\r\n* Fix tests\r\n\r\n* Add tests and fixes\r\n\r\n* Update styles\r\n\r\n* Add rotating of label on rectangle\r\n\r\n* Update entities header\r\n\r\n* Fix tests\r\n\r\n* Add eslint rules for codeceptjs\r\n\r\n* Add constraints to applying labels\r\n\r\n- preventing of applying region labels to semantically incompatible regions\r\n- test\r\n\r\n* Add textarea focusing by dblclick and fixs\r\n\r\n* Hide duplicate text\r\n\r\n* Clean\r\n\r\n* Add autofocus textarea by selectAfterCreate setting\r\n\r\n* Fix text selection in region item\r\n\r\n* Fix autofocus on textarea for different shapes\r\n\r\n* Fix label name computing\r\n\r\n* Add submitting text when collapsing region item\r\n\r\n* Fix tests\r\n\r\n* Fix tests\r\n\r\n* Fix focusing\r\n\r\n* Add focus by enter instead of autofocus\r\n\r\n* Add scrolling selected region item into view\r\n\r\n* Fix tests\r\n\r\n* Fix removing area under cursor\r\n\r\n* Fix brush size at slider\r\n\r\n* Add deserialization test on OCR mode\r\n\r\n* Fix sidebar textarea styles\r\n\r\n* Fix image rotating in two columns template\r\n\r\n* Fix tests\r\n\r\nCo-authored-by: Koshevarov Sergey <Gondragos@gmail.com>",
"commit": "1cef63d2a8fd1d345cd21657fced5242ff521994",
"message": "Improve Labels styles",
"commit": "5a34b62e57653484bb5d9924cfd821a7b81de996",
"branch": "master",
"date": "2021-06-29T20:13:02Z"
"date": "2021-06-30T20:10:42Z"
}

0 comments on commit e3431c8

Please sign in to comment.