mirror of https://github.com/doccano/doccano.git
12 changed files with 323 additions and 169 deletions
Split View
Diff Options
-
24app/server/models.py
-
67app/server/templates/admin/dataset_download.html
-
98app/server/templates/admin/dataset_upload.html
-
28app/server/templates/admin/download/base.html
-
32app/server/templates/admin/download/seq2seq.html
-
19app/server/templates/admin/download/sequence_labeling.html
-
32app/server/templates/admin/download/text_classification.html
-
51app/server/templates/admin/upload/base.html
-
40app/server/templates/admin/upload/seq2seq.html
-
48app/server/templates/admin/upload/sequence_labeling.html
-
40app/server/templates/admin/upload/text_classification.html
-
13app/server/views.py
@ -1,67 +0,0 @@ |
|||
{% extends "admin/admin_base.html" %} |
|||
{% load static %} |
|||
{% block content-area %} |
|||
<div class="columns"> |
|||
<div class="column is-12"> |
|||
<div class="card"> |
|||
<header class="card-header"> |
|||
<p class="card-header-title"> |
|||
File Downloader |
|||
</p> |
|||
</header> |
|||
<div class="card-content"> |
|||
<h2 class="subtitle">Download labeled data.</h2> |
|||
|
|||
<div class="control"> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="csv" :checked="format=='csv'" v-model="format"> |
|||
CSV |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
</div> |
|||
<pre v-show="format=='csv'" class="code-block"> |
|||
<code class="csv"> |
|||
// Text classification format. |
|||
id,text,label,user |
|||
1,"Terrible customer service.",1,1 |
|||
2,"Really great transaction.",2,1 |
|||
3,"Great price.",1,1 |
|||
... |
|||
|
|||
// Sequence to sequence format. |
|||
id,text,label,user |
|||
1,"Hello!","こんにちは!",1 |
|||
2,"Good morning.","おはようございます。",1 |
|||
3,"See you.","さようなら。",1 |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
// Text classification format. |
|||
{"id": 2, "text": "Great price.", "annotations": [{"id": 3, "prob": 0.0, "label": 1, "user": 1}]} |
|||
... |
|||
|
|||
// Sequence labeling format. |
|||
{"id": 2, "text": "President Obama", "annotations": [{"id": 3, "prob": 0.0, "label": 1, "start_offset": 10, "end_offset": 15, "user": 1}]} |
|||
... |
|||
|
|||
// Sequence to sequence format. |
|||
{"id": 2, "text": "Hello!", "annotations": [{"id": 3, "prob": 0.0, "label": "こんにちは!", "user": 1}]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
|
|||
<button type="submit" class="button is-primary" @click="download()">Download</button> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
{% endblock %} |
|||
{% block footer %} |
|||
<script src="{% static 'bundle/upload.js' %}"></script> |
|||
{% endblock %} |
@ -1,98 +0,0 @@ |
|||
{% extends "admin/admin_base.html" %} |
|||
{% load static %} |
|||
{% block content-area %} |
|||
<div class="columns"> |
|||
<div class="column is-12"> |
|||
|
|||
<div class="card"> |
|||
<header class="card-header"> |
|||
<p class="card-header-title"> |
|||
File Uploader |
|||
</p> |
|||
</header> |
|||
<div class="card-content"> |
|||
<h2 class="subtitle">Upload a file to annotate text.</h2> |
|||
|
|||
<div class="control"> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="plain" :checked="format=='plain'" v-model="format"> |
|||
Plain |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="csv" :checked="format=='csv'" v-model="format"> |
|||
CSV |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
</div> |
|||
|
|||
<pre v-show="format=='plain'" class="code-block"> |
|||
<code class="csv"> |
|||
Terrible customer service. |
|||
Really great transaction. |
|||
Great price. |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='csv'" class="code-block"> |
|||
<code class="csv"> |
|||
// Text classification format. |
|||
text,label |
|||
"Terrible customer service.","negative" |
|||
"Really great transaction.","positive" |
|||
"Great price.","positive" |
|||
... |
|||
|
|||
// Sequence to sequence format. |
|||
text,label |
|||
"Hello!","こんにちは!" |
|||
"Good morning.","おはようございます。" |
|||
"See you.","さようなら。" |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
// Text classification format. |
|||
{"text": "Great price.", "labels": ["positive"]} |
|||
... |
|||
|
|||
// Sequence labeling format. |
|||
{"text": "President Obama", "labels": [ [10, 15, "PERSON"] ]} |
|||
... |
|||
|
|||
// Sequence to sequence format. |
|||
{"text": "Hello!", "labels": ["こんにちは!"]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
|
|||
|
|||
<div class="control"> |
|||
<div class="file has-name is-primary"> |
|||
<label class="file-label"> |
|||
<input class="file-input" type="file" ref="file" name="file" required v-on:change="upload()"> |
|||
<span class="file-cta"> |
|||
<span class="file-icon"> |
|||
<i class="fas fa-upload"></i> |
|||
</span> |
|||
<span class="file-label"> |
|||
Select a file… |
|||
</span> |
|||
</span> |
|||
<span class="file-name"> |
|||
[[ file.name ]] |
|||
</span> |
|||
</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
{% endblock %} |
|||
{% block footer %} |
|||
<script src="{% static 'bundle/upload.js' %}"></script> |
|||
{% endblock %} |
@ -0,0 +1,28 @@ |
|||
{% extends "admin/admin_base.html" %} |
|||
{% load static %} |
|||
{% block content-area %} |
|||
<div class="columns"> |
|||
<div class="column is-12"> |
|||
<div class="card"> |
|||
<header class="card-header"> |
|||
<p class="card-header-title"> |
|||
File Downloader |
|||
</p> |
|||
</header> |
|||
<div class="card-content"> |
|||
<h2 class="subtitle">Download labeled data.</h2> |
|||
|
|||
<div class="control"> |
|||
{% block select-format-area %}{% endblock %} |
|||
</div> |
|||
{% block example-format-area %}{% endblock %} |
|||
<button type="submit" class="button is-primary" @click="download()">Download</button> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
{% endblock %} |
|||
{% block footer %} |
|||
<script src="{% static 'bundle/upload.js' %}"></script> |
|||
{% endblock %} |
@ -0,0 +1,32 @@ |
|||
{% extends "admin/download/base.html" %} |
|||
{% load static %} |
|||
{% block select-format-area %} |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="csv" :checked="format=='csv'" v-model="format"> |
|||
CSV |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
{% endblock %} |
|||
|
|||
{% block example-format-area %} |
|||
<pre v-show="format=='csv'" class="code-block"> |
|||
<code class="csv"> |
|||
id,text,label,user |
|||
1,"Hello!","こんにちは!",1 |
|||
2,"Good morning.","おはようございます。",1 |
|||
3,"See you.","さようなら。",1 |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
{"id": 1, "text": "Hello!", "annotations": [{"id": 1, "label": "こんにちは!", "user": 1}]} |
|||
{"id": 2, "text": "Good morning.", "annotations": [{"id": 2, "label": "おはようございます。", "user": 1}]} |
|||
{"id": 3, "text": "See you.", "annotations": [{"id": 3, "label": "さようなら。", "user": 1}]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
{% endblock %} |
@ -0,0 +1,19 @@ |
|||
{% extends "admin/download/base.html" %} |
|||
{% load static %} |
|||
{% block select-format-area %} |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
{% endblock %} |
|||
|
|||
{% block example-format-area %} |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
{"id": 1, "text": "EU rejects ...", "annotations": [{"id": 1, "label": 2, "start_offset": 0, "end_offset": 2, "user": 1}]} |
|||
{"id": 2, "text": "Peter Blackburn", "annotations": [{"id": 2, "label": 1, "start_offset": 0, "end_offset": 15, "user": 1}]} |
|||
{"id": 3, "text": "President Obama", "annotations": [{"id": 3, "label": 1, "start_offset": 10, "end_offset": 15, "user": 1}]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
{% endblock %} |
@ -0,0 +1,32 @@ |
|||
{% extends "admin/download/base.html" %} |
|||
{% load static %} |
|||
{% block select-format-area %} |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="csv" :checked="format=='csv'" v-model="format"> |
|||
CSV |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
{% endblock %} |
|||
|
|||
{% block example-format-area %} |
|||
<pre v-show="format=='csv'" class="code-block"> |
|||
<code class="csv"> |
|||
id,text,label,user |
|||
1,"Terrible customer service.",1,1 |
|||
2,"Really great transaction.",2,1 |
|||
3,"Great price.",2,1 |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
{"id": 1, "text": "Terrible customer service.", "annotations": [{"id": 1, "label": 1, "user": 1}]} |
|||
{"id": 2, "text": "Really great transaction.", "annotations": [{"id": 2, "label": 2, "user": 1}]} |
|||
{"id": 3, "text": "Great price.", "annotations": [{"id": 3, "label": 2, "user": 1}]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
{% endblock %} |
@ -0,0 +1,51 @@ |
|||
{% extends "admin/admin_base.html" %} |
|||
{% load static %} |
|||
{% block content-area %} |
|||
<div class="columns"> |
|||
<div class="column is-12"> |
|||
|
|||
<div class="card"> |
|||
<header class="card-header"> |
|||
<p class="card-header-title"> |
|||
File Uploader |
|||
</p> |
|||
</header> |
|||
<div class="card-content"> |
|||
<h2 class="subtitle">Upload a file to annotate text.</h2> |
|||
|
|||
<div class="control"> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="plain" :checked="format=='plain'" v-model="format"> |
|||
Plain |
|||
</label> |
|||
{% block select-format-area %}{% endblock %} |
|||
</div> |
|||
|
|||
{% block example-format-area %}{% endblock %} |
|||
|
|||
<div class="control"> |
|||
<div class="file has-name is-primary"> |
|||
<label class="file-label"> |
|||
<input class="file-input" type="file" ref="file" name="file" required v-on:change="upload()"> |
|||
<span class="file-cta"> |
|||
<span class="file-icon"> |
|||
<i class="fas fa-upload"></i> |
|||
</span> |
|||
<span class="file-label"> |
|||
Select a file… |
|||
</span> |
|||
</span> |
|||
<span class="file-name"> |
|||
[[ file.name ]] |
|||
</span> |
|||
</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
{% endblock %} |
|||
{% block footer %} |
|||
<script src="{% static 'bundle/upload.js' %}"></script> |
|||
{% endblock %} |
@ -0,0 +1,40 @@ |
|||
{% extends "admin/upload/base.html" %} |
|||
{% load static %} |
|||
{% block select-format-area %} |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="csv" :checked="format=='csv'" v-model="format"> |
|||
CSV |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
{% endblock %} |
|||
|
|||
{% block example-format-area %} |
|||
<pre v-show="format=='plain'" class="code-block"> |
|||
<code class="csv"> |
|||
Hello! |
|||
Good morning. |
|||
See you. |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='csv'" class="code-block"> |
|||
<code class="csv"> |
|||
text,label |
|||
"Hello!","こんにちは!" |
|||
"Good morning.","おはようございます。" |
|||
"See you.","さようなら。" |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
{"text": "Hello!", "labels": ["こんにちは!"]} |
|||
{"text": "Good morning.", "labels": ["おはようございます。"]} |
|||
{"text": "See you.", "labels": ["さようなら。"]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
{% endblock %} |
@ -0,0 +1,48 @@ |
|||
{% extends "admin/upload/base.html" %} |
|||
{% load static %} |
|||
{% block select-format-area %} |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="conll" :checked="format=='conll'" v-model="format"> |
|||
CoNll |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
{% endblock %} |
|||
|
|||
{% block example-format-area %} |
|||
<pre v-show="format=='plain'" class="code-block"> |
|||
<code class="csv"> |
|||
EU rejects German call to boycott British lamb. |
|||
Peter Blackburn |
|||
President Obama |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='conll'" class="code-block"> |
|||
<code class="csv"> |
|||
EU B-ORG |
|||
rejects O |
|||
German B-MISC |
|||
call O |
|||
to O |
|||
boycott O |
|||
British B-MISC |
|||
lamb O |
|||
. O |
|||
|
|||
Peter B-PER |
|||
Blackburn I-PER |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
{"text": "EU rejects German call to boycott British lamb.", "labels": [ [0, 2, "ORG"], [11, 17, "MISC"], ... ]} |
|||
{"text": "Peter Blackburn", "labels": [ [0, 15, "PERSON"] ]} |
|||
{"text": "President Obama", "labels": [ [10, 15, "PERSON"] ]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
{% endblock %} |
@ -0,0 +1,40 @@ |
|||
{% extends "admin/upload/base.html" %} |
|||
{% load static %} |
|||
{% block select-format-area %} |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="csv" :checked="format=='csv'" v-model="format"> |
|||
CSV |
|||
</label> |
|||
<label class="radio"> |
|||
<input type="radio" name="format" value="json" :checked="format=='json'" v-model="format"> |
|||
JSONL |
|||
</label> |
|||
{% endblock %} |
|||
|
|||
{% block example-format-area %} |
|||
<pre v-show="format=='plain'" class="code-block"> |
|||
<code class="csv"> |
|||
Terrible customer service. |
|||
Really great transaction. |
|||
Great price. |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='csv'" class="code-block"> |
|||
<code class="csv"> |
|||
text,label |
|||
"Terrible customer service.","negative" |
|||
"Really great transaction.","positive" |
|||
"Great price.","positive" |
|||
... |
|||
</code> |
|||
</pre> |
|||
<pre v-show="format=='json'" class="code-block"> |
|||
<code class="json"> |
|||
{"text": "Terrible customer service.", "labels": ["negative"]} |
|||
{"text": "Really great transaction.", "labels": ["positive"]} |
|||
{"text": "Great price.", "labels": ["positive"]} |
|||
... |
|||
</code> |
|||
</pre> |
|||
{% endblock %} |
Write
Preview
Loading…
Cancel
Save