mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 11:24:18 +00:00
173 lines
6.9 KiB
Django/Jinja
173 lines
6.9 KiB
Django/Jinja
{% extends "base.html.j2" %}
|
||
{% import "materialize/wtf.html.j2" as wtf %}
|
||
|
||
{% block main_attribs %} class="service-scheme" data-service="tesseract-ocr-pipeline"{% endblock main_attribs %}
|
||
|
||
{% block page_content %}
|
||
<div class="container">
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<h1 id="title">{{ title }}</h1>
|
||
</div>
|
||
|
||
<div class="col s12 m3 push-m9">
|
||
<div class="center-align">
|
||
<p class="hide-on-small-only"> </p>
|
||
<p class="hide-on-small-only"> </p>
|
||
<a class="btn-floating btn-large btn-scale-x2 waves-effect waves-light">
|
||
<i class="nopaque-icons service-color darken service-icons" data-service="tesseract-ocr-pipeline"></i>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col s12 m9 pull-m3">
|
||
<div class="card service-color-border border-darken" data-service="tesseract-ocr-pipeline" style="border-top: 10px solid;">
|
||
<div class="card-content">
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<div class="card-panel z-depth-0">
|
||
<span class="card-title"><i class="left material-icons">layers</i>OCR</span>
|
||
<p>In this process, nopaque converts your image data – like photos or scans – into text data. This step enables you to proceed with the computational analysis of your documents.</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col s12">
|
||
<h2>Submit a job</h2>
|
||
<div class="card">
|
||
<div class="card-content">
|
||
<p>Add an existing file from your workflow or add a new one below.</p>
|
||
<div class="job-output-list" data-user-id="{{ current_user.hashid}}" data-job-ids="{{ choosable_job_ids }}"></div>
|
||
</div>
|
||
<div class="card-action right-align">
|
||
<a class="waves-effect waves-light btn"><i class="material-icons right">send</i>Submit</a>
|
||
</div>
|
||
</div>
|
||
<div class="card">
|
||
<form class="create-job-form" enctype="multipart/form-data" method="POST">
|
||
<div class="card-content">
|
||
{{ form.hidden_tag() }}
|
||
<div class="row">
|
||
<div class="col s12 l4">
|
||
{{ wtf.render_field(form.title, material_icon='title') }}
|
||
</div>
|
||
<div class="col s12 l8">
|
||
{{ wtf.render_field(form.description, material_icon='description') }}
|
||
</div>
|
||
<div class="col s12 l5">
|
||
{{ wtf.render_field(form.pdf, accept='application/pdf', placeholder='Choose a PDF file') }}
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
<div class="col s12 l4">
|
||
<div class="input-field">
|
||
<i class="material-icons prefix">language</i>
|
||
{{ form.model() }}
|
||
{{ form.model.label }}
|
||
<span class="helper-text">
|
||
<a class="modal-trigger tooltipped" href="#models-modal" data-position="bottom" data-tooltip="See more information about models"><i class="material-icons" style="color:#00A58B;">help_outline</i></a>
|
||
<a class="tooltipped" href="{{ url_for('contributions.create_tesseract_ocr_pipeline_model') }}" data-position="bottom" data-tooltip="Add your own Tesseract OCR models"><i class="material-icons" style="color:#00A58B">new_label</i></a>
|
||
</span>
|
||
{% for error in form.model.errors %}
|
||
<span class="helper-text error-color-text">{{ error }}</span>
|
||
{% endfor %}
|
||
</div>
|
||
</div>
|
||
<div class="col s12 l3">
|
||
{{ wtf.render_field(form.version, material_icon='apps') }}
|
||
</div>
|
||
<div class="col s12">
|
||
<span class="card-title">Preprocessing</span>
|
||
</div>
|
||
{% if 'disabled' not in form.binarization.render_kw or not form.binarization.render_kw['disabled'] %}
|
||
<div class="col s9">
|
||
<p>{{ form.binarization.label.text }}</p>
|
||
<p class="light">Based on a brightness threshold pixels are converted into either black or white. It is useful to reduce noise in images. (<b>longer duration</b>)</p>
|
||
</div>
|
||
<div class="col s3 right-align">
|
||
<div class="switch">
|
||
<label>
|
||
{{ form.binarization() }}
|
||
<span class="lever"></span>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
{% if 'disabled' not in form.ocropus_nlbin_threshold.render_kw or not form.ocropus_nlbin_threshold.render_kw['disabled'] %}
|
||
<div class="col s9 hide" id="create-job-form-ocropus_nlbin_threshold-container">
|
||
<br>
|
||
<p>Intensity (between 0 and 1)</p>
|
||
<p class="range-field">{{ form.ocropus_nlbin_threshold() }}</p>
|
||
</div>
|
||
{% endif %}
|
||
<!--
|
||
Seperate each setting with the following
|
||
<div class="col s12"><p> </p></div>
|
||
<div class="col s12 divider"></div>
|
||
<div class="col s12"><p> </p></div>
|
||
-->
|
||
</div>
|
||
</div>
|
||
<div class="card-action right-align">
|
||
{{ wtf.render_field(form.submit, material_icon='send') }}
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{% endblock page_content %}
|
||
|
||
{% block modals %}
|
||
{{ super() }}
|
||
<div id="models-modal" class="modal">
|
||
<div class="modal-content">
|
||
<h4>Tesseract OCR Pipeline models</h4>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Title</th>
|
||
<th>Description</th>
|
||
<th>Biblio</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for m in tesseract_ocr_pipeline_models %}
|
||
<tr id="tesseract-ocr-pipeline-model-{{ m.hashid }}">
|
||
<td>{{ m.title }}</td>
|
||
{% if m.description == '' %}
|
||
<td>Description is not available.</td>
|
||
{% else %}
|
||
<td>{{ m.description }}</td>
|
||
{% endif %}
|
||
<td><a href="{{ m.publisher_url }}">{{ m.publisher }}</a> ({{ m.publishing_year }}), {{ m.title }} {{ m.version}}, <a href="{{ m.publishing_url }}">{{ m.publishing_url }}</a></td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<a href="#!" class="modal-close waves-effect waves-light btn">Close</a>
|
||
</div>
|
||
</div>
|
||
{% endblock modals %}
|
||
|
||
{% block scripts %}
|
||
{{ super() }}
|
||
<script>
|
||
|
||
// Disable user model selection if no models are available
|
||
{% if user_tesseract_ocr_pipeline_models_count == 0 %}
|
||
optionGroupOptions = document.querySelectorAll(".optgroup-option");
|
||
optionGroupOptions[0].classList.add("disabled");
|
||
{% endif %}
|
||
|
||
document.querySelector('#create-job-form-binarization').addEventListener('change', (event) => {
|
||
document.querySelector('#create-job-form-ocropus_nlbin_threshold-container').classList.toggle('hide');
|
||
});
|
||
</script>
|
||
{% endblock scripts %}
|