Browse Source

Add dataset upload template

pull/10/head
Hironsan 7 years ago
parent
commit
a7a263b39c
3 changed files with 44 additions and 1 deletions
  1. 37
      app/server/templates/admin/dataset_upload.html
  2. 3
      app/server/urls.py
  3. 5
      app/server/views.py

37
app/server/templates/admin/dataset_upload.html

@ -0,0 +1,37 @@
{% extends "admin/admin_base.html" %} {% load static %} {% block content-area %}
<div class="column is-7">
<h1>Import text items</h1>
<p>
To build a custom model, you first need to import a set of text items to train it. Generally the more text items the better.
Each item should be categorized with a label (labels are essential for telling the model how to classify text). AutoML
Natural Language currently supports English text only.
</p>
<div class="content">
<p>Upload a CSV file from your computer</p>
<div class="file">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Select a file…
</span>
</span>
</label>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-primary">Upload dataset</button>
</div>
<div class="control">
<button class="button is-text">Cancel</button>
</div>
</div>
</div>
{% endblock %}

3
app/server/urls.py

@ -1,7 +1,7 @@
from django.urls import path
from .views import IndexView
from .views import ProjectView, DatasetView
from .views import ProjectView, DatasetView, DatasetUpload
from .views import ProjectsView, ProjectAdminView, RawDataAPI, DataDownloadAPI
from rest_framework import routers
from .views import ProjectViewSet
@ -25,4 +25,5 @@ urlpatterns = [
path('projects/<int:project_id>/', ProjectView.as_view(), name='annotation'),
path('projects/<int:pk>/apis/raw_data', RawDataAPI.as_view(), name='data_api'),
path('projects/<int:pk>/docs', DatasetView.as_view(), name='dataset'),
path('projects/<int:pk>/docs/create', DatasetUpload.as_view(), name='dataset-upload'),
]

5
app/server/views.py

@ -50,6 +50,11 @@ class DatasetView(LoginRequiredMixin, DetailView):
template_name = 'admin/dataset.html'
class DatasetUpload(LoginRequiredMixin, DetailView):
model = Project
template_name = 'admin/dataset_upload.html'
class RawDataAPI(View):
def post(self, request, *args, **kwargs):

Loading…
Cancel
Save