{% blocktrans with site.name as site_name %}Please sign in with one 18 | of your existing third party accounts. Or, sign up 19 | for a {{ site_name }} account and sign in below:{% endblocktrans %}
20 | 21 | 31 | 32 | {% include "socialaccount/snippets/login_extra.html" %} 33 | 34 | {% else %} 35 |{% blocktrans %}If you have not created an account yet, then please 36 | sign up first.{% endblocktrans %}
37 | {% endif %} 38 | 39 | 48 | 49 |{% blocktrans %}Already have an account? Then please sign in.{% endblocktrans %}
13 | 14 | 22 |Model_ID | 15 |Lang_ID | 16 |Language Name | 17 |Phones | 18 |
---|---|---|---|
{{ model }} | 23 |{{ lang_id }} | 24 |{{ lang_name }} | 25 |Phones | 26 |
Something went wrong!
32 | {% endif %} 33 |You are logged in as {{ user.username }}. Logout
10 | 11 | {% else %} 12 | 13 | 14 | {% endif %} 15 | 16 | 17 | -------------------------------------------------------------------------------- /templates/user_profile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |You are logged in as {{ user.username }} ({{ user.email }})
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/echo_cmulab_ocr_test_single-source.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -i 2 | 3 | # disable "Monitor mode" to prevent child processes from running in a separate process group 4 | set +m 5 | 6 | [[ $# -ne 4 ]] && { echo "Usage: $0 test_file.zip model_dir/ output_folder/ log_file"; exit 1; } 7 | 8 | test_src_zip=$(readlink -ve $1) || exit 1 9 | expt_folder=$(readlink -ve $2) || exit 1 10 | output_folder=$(readlink -ve $3) || exit 1 11 | log_file=$4 12 | 13 | mkdir -p $output_folder 14 | 15 | cd $(dirname $0) 16 | 17 | 18 | # Set test source file (test_tgt is optional, can be used to compute CER and WER of the predicted output) 19 | #test_src="sample_dataset/postcorrection/training/test_src1.txt" 20 | 21 | dynet_mem=1000 # Memory in MB available for testing 22 | 23 | params="--pretrain_dec --pretrain_s2s --pretrain_enc --pointer_gen --coverage --diag_loss 2" 24 | trained_model_name="my_trained_model" 25 | 26 | # ------------------------------END: Required experimental settings------------------------------ 27 | 28 | eval $(conda shell.bash hook) &>/dev/null 29 | conda activate ocr-post-correction &>/dev/null 30 | source activate ocr-post-correction &>/dev/null 31 | echo $CONDA_DEFAULT_ENV 32 | echo $CONDA_PREFIX 33 | 34 | set -x 35 | 36 | mkdir -p $output_folder/inputs/ 37 | (cd $output_folder/inputs/; unzip -j $test_src_zip) 38 | 39 | mkdir -p $output_folder/outputs/ 40 | 41 | # Load the trained model and get the predicted output on the test set (add --dynet-gpu for using GPU) 42 | shopt -s nullglob 43 | for test_src in $output_folder/inputs/*; do 44 | echo python postcorrection/multisource_wrapper.py \ 45 | --dynet-mem $dynet_mem \ 46 | --dynet-autobatch 1 \ 47 | --test_src1 $test_src \ 48 | $params \ 49 | --single \ 50 | --vocab_folder $expt_folder/vocab/ \ 51 | --output_folder $output_folder/ \ 52 | --load_model $expt_folder"/models/"$trained_model_name \ 53 | --testing 54 | echo "Test output" > $output_folder/outputs/$(basename $test_src).output 55 | done 56 | 57 | if [ "$(ls -A ${output_folder}/outputs/)" ]; then 58 | echo "Job completed successfully!" 59 | exit 0 60 | else 61 | echo "Job failed!" 62 | exit 1 63 | fi 64 | -------------------------------------------------------------------------------- /tests/http_ocr_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | testData=$(readlink -ve $1) || exit 1 4 | model_id=$2 5 | email=$3 6 | 7 | http --form POST http://localhost:8088/annotator/test_single_source_ocr/ model_id=${model_id} email=${email} testData@${testData} 8 | -------------------------------------------------------------------------------- /tests/http_ocr_train.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | srcData=$(readlink -ve $1) || exit 1 4 | tgtData=$(readlink -ve $2) || exit 1 5 | unlabeledData=$(readlink -ve $3) || exit 1 6 | email=$4 7 | 8 | #http --form POST http://localhost:8088/annotator/train_single_source_ocr/ trainData@${trainData} email=${email} unlabeledData@${unlabeledData} 9 | http --form POST http://localhost:8088/annotator/train_single_source_ocr/ \ 10 | srcData@${srcData} \ 11 | tgtData@${tgtData} \ 12 | email=${email} \ 13 | unlabeledData@${unlabeledData} 14 | -------------------------------------------------------------------------------- /tests/http_translate_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | toolkit=$1 4 | model_id=$2 5 | lang_from=$3 6 | lang_to=$4 7 | text="$5" 8 | 9 | http --form POST http://localhost:8088/annotator/translate toolkit=${toolkit} model_id=${model_id} lang_from=${lang_from} lang_to=${lang_to} text="${text}" -------------------------------------------------------------------------------- /tests/test_ocr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import requests 6 | import json 7 | from pathlib import Path 8 | 9 | auth_token = (Path.home() / '.cmulab_elan').read_text().split()[-1] 10 | server_url = "http://localhost:8088" 11 | with open(sys.argv[1],'rb') as image_file1, open(sys.argv[2],'rb') as image_file2: 12 | files = [('file', image_file1), ('file', image_file2)] 13 | url = server_url + "/annotator/ocr-post-correction/" 14 | # will let you know how to get the auth token, have another API for that 15 | r = requests.post(url, files=files, data={"params": json.dumps({"threshold": 1, "debug": True})}, headers={"Authorization": auth_token}) 16 | print(r.text) 17 | --------------------------------------------------------------------------------