Skip to content

Commit

Permalink
Release/0.8.2 (#496)
Browse files Browse the repository at this point in the history
* Fix some dependencies

* LSF build 3f0e7f5

* Make relative paths in config.json, extract IDs from source storage keys, pass project full path in ML backend

* Update converter to 0.0.21

* Add utils for getting uploaded local files

* Update converter package

* Update LSF 64d1468

* Add Paragrahs/Taxonomy samples, rewrite sample task generation

* Update LSF, handle secure mode

* Fix secure mode for Text object

* Remove absolute paths from config

* Change version to 0.8.2

* Fix ml server path for Windows

* Update LSF 38a8537

* Fix export dir

* Update LSF 2b48362

* Fix type validation for paragraphs

* Update LSF 8f89391

* Add ML backend for GPT2 Chatbot generator based on <Paragraphs> + new template

* Add docs for Paragraphs and Taxonomy

* Add paragraphs reference, fix doc

* Change tooltip texts

* Upgrade converters: fix export with relations

* Add new icons to templates

* Fix center for icons

Co-authored-by: nik <[email protected]>
Co-authored-by: makseq-msi3 <[email protected]>
Co-authored-by: hlomzik <[email protected]>
  • Loading branch information
4 people authored Dec 1, 2020
1 parent 269df7f commit e34e4cd
Show file tree
Hide file tree
Showing 64 changed files with 446 additions and 185 deletions.
1 change: 1 addition & 0 deletions docs/source/guide/ml.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ That gives you the opportunities to use:
- [Text classification with Scikit-Learn](/tutorials/sklearn-text-classifier.html)
- [Transfer learning for images with PyTorch](/tutorials/pytorch-image-transfer-learning.html)
- [Image Object Detector](/tutorials/object-detector.html)
- [Chatbot response generation with HuggingFace's GPT2 model](/tutorials/gpt.html)

#### Create ML backend

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/choice.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Choice
type: tags
order: 402
order: 403
---

Choice tag represents a single choice
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/choices.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Choices
type: tags
order: 403
order: 404
---

Choices tag, create a group of choices, radio, or checkboxes. Shall
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/ellipse.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Ellipse
type: tags
order: 404
order: 405
---

Ellipse
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/ellipselabels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: EllipseLabels
type: tags
order: 405
order: 406
---

EllipseLabels tag creates labeled ellipses
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/hypertextlabels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: HyperTextLabels
type: tags
order: 406
order: 407
---

HyperTextLabels tag creates labeled hyper text (HTML)
Expand Down
3 changes: 2 additions & 1 deletion docs/source/tags/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type: tags
order: 304
---

Image tag shows an image on the page
Image tag shows an image on the page.
All the region numbers are percents of image original sizes — [0, 100]

### Parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/keypoint.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: KeyPoint
type: tags
order: 407
order: 408
---

KeyPoint is used to add a keypoint to an image without label selection. It's useful when you have only one label.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/keypointlabels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: KeyPointLabels
type: tags
order: 408
order: 409
---

KeyPointLabels tag
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/label.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Label
type: tags
order: 409
order: 410
---

Label tag represents a single label
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/labels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Labels
type: tags
order: 410
order: 411
---

Labels tag, create a group of labels
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/list.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: List
type: tags
order: 411
order: 412
---

List element, used for ranking results. Great choice for recomendation systems.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/pairwise.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Pairwise
type: tags
order: 412
order: 413
---

Pairwise element. Compare two different objects, works with any label studio object
Expand Down
27 changes: 27 additions & 0 deletions docs/source/tags/paragraphlabels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: ParagraphLabels
type: tags
order: 414
is_new: t
---

ParagraphLabels tag
ParagraphLabels tag creates labeled paragraph

### Parameters

| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | name of the element |
| toName | <code>string</code> | name of the html element to label |

### Example
```html
<View>
<ParagraphLabels name="labels" toName="prg">
<Label value="Face" />
<Label value="Nose" />
</ParagraphLabels>
<Paragraphs name="prg" value="$dialogue" layout="dialogue" />
</View>
```
29 changes: 29 additions & 0 deletions docs/source/tags/paragraphs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Paragraphs
type: tags
order: 305
is_new: t
---

Paragraphs tag shows an Paragraphs markup that can be labeled
it expects an array of objects like that `[{ $nameKey: "Author name", $textKey: "Text" }, ... ]`

### Parameters

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| name | <code>string</code> | | name of the element |
| value | <code>string</code> | | value of the element |
| [valueType] | <code>json</code> \| <code>url</code> | <code>json</code> | how to treat value — as data or as url with data to load from |
| audioUrl | <code>string</code> | | audio to sync phrases with |
| [saveTextResult] | <code>no</code> \| <code>yes</code> | <code>yes</code> | whether to save `text` to `value` or not |
| [layout] | <code>none</code> \| <code>dialogue</code> | <code>none</code> | the styles layout to use |
| [nameKey] | <code>string</code> | <code>&quot;author&quot;</code> | name key to use |
| [textKey] | <code>string</code> | <code>&quot;text&quot;</code> | text key to use |

### Example
```html
<View>
<Paragraphs name="dialogue-1" value="$dialogue" layout="dialogue" />
</View>
```
2 changes: 1 addition & 1 deletion docs/source/tags/polygon.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Polygon
type: tags
order: 413
order: 415
---

Polygon is used to add polygons to an image without label selection. It's useful when you have only one label.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/polygonlabels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: PolygonLabels
type: tags
order: 414
order: 416
---

PolygonLabels tag, create labeled polygons
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/ranker.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Ranker
type: tags
order: 415
order: 417
---

Ranker tag, used to ranking models
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/rating.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Rating
type: tags
order: 416
order: 418
---

Rating adds rating selection
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/rectangle.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Rectangle
type: tags
order: 417
order: 419
---

Rectangle is used to add rectangle (Bounding Box) to an image without label selection. It's useful when you have
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/rectanglelabels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: RectangleLabels
type: tags
order: 418
order: 420
---

RectangleLabels tag creates labeled rectangles
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/relation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Relation
type: tags
order: 419
order: 421
---

Relation tag represents a single relation label
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/relations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Relations
type: tags
order: 420
order: 422
---

Relations tag, create relations labels
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/shortcut.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Shortcut
type: tags
order: 421
order: 423
---

Shortcut tag can be used to define a shortcut, which adds a predefined object
Expand Down
34 changes: 34 additions & 0 deletions docs/source/tags/taxonomy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Taxonomy
type: tags
order: 424
is_new: t
---

Taxonomy tag allows to select one or more hierarchical labels
storing both label and their ancestors.

### Parameters

| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | name of the group |
| toName | <code>string</code> | name of the element that you want to label |

### Example
```html
<View>
<Taxonomy name="media" toName="text">
<Choice value="Online">
<Choice value="UGC" />
<Choice value="Free" />
<Choice value="Paywall">
<Choice value="NYC Times" />
<Choice value="The Wall Street Journal" />
</Choice>
</Choice>
<Choice value="Offline" />
</Taxonomy>
<Text name="text" value="You never believe what he did to the country" />
</View>
```
6 changes: 4 additions & 2 deletions docs/source/tags/text.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
title: Text
type: tags
order: 305
order: 306
---

Text tag shows an Text markup that can be labeled
Text tag shows an Text markup that can be labeled.
You can use `<Style>.htx-text{ white-space: pre-wrap; }</Style>` to preserve all the spaces.
In any case every space counts for result offsets.

### Parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/textarea.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: TextArea
type: tags
order: 422
order: 425
---

TextArea tag shows the textarea for user input
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/timeseries.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: TimeSeries
type: tags
order: 306
order: 307
---

TimeSeries tag can be used to label time series data.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tags/timeserieslabels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: TimeSeriesLabels
type: tags
order: 423
order: 426
---

TimeSeriesLabels tag creates labeled time range
Expand Down
1 change: 1 addition & 0 deletions docs/source/tutorials/gpt.md
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion label_studio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
package_name = 'label-studio'

# Package version
__version__ = '0.8.1.post0'
__version__ = '0.8.2'
14 changes: 6 additions & 8 deletions label_studio/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,20 +693,18 @@ def api_export():
"""
export_format = request.args.get('format')
now = datetime.now()
completion_dir = g.project.config['output_dir']

project_export_dir = os.path.join(os.path.dirname(completion_dir), 'export')
os.makedirs(project_export_dir, exist_ok=True)
os.makedirs(g.project.export_dir, exist_ok=True)

zip_dir = os.path.join(project_export_dir, now.strftime('%Y-%m-%d-%H-%M-%S'))
zip_dir = os.path.join(g.project.export_dir, now.strftime('%Y-%m-%d-%H-%M-%S'))
os.makedirs(zip_dir, exist_ok=True)

g.project.converter.convert(completion_dir, zip_dir, format=export_format)
g.project.converter.convert(g.project.output_dir, zip_dir, format=export_format)
shutil.make_archive(zip_dir, 'zip', zip_dir)
shutil.rmtree(zip_dir)

response = send_file(zip_dir+'.zip', as_attachment=True)
response.headers['filename'] = os.path.basename(zip_dir+'.zip')
zip_dir_full_path = os.path.abspath(zip_dir + '.zip')
response = send_file(zip_dir_full_path, as_attachment=True)
response.headers['filename'] = os.path.basename(zip_dir_full_path)
return response


Expand Down
16 changes: 16 additions & 0 deletions label_studio/examples/html_chatbot/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- {"title": "Chatbot", "category": "html", "complexity": "basic", "new": true, "order": "2"} -->
<View>
<Paragraphs
name="dialogue"
value="$dialogue"
layout="dialogue"
savetextresult="yes"
nameKey="speaker"
textKey="phrase"
/>
<TextArea name="response" toName="dialogue"
editable="true"
required="true"
placeholder="Put your response here..."/>
</View>

Loading

0 comments on commit e34e4cd

Please sign in to comment.