Commit ed039a9b authored by Yoann HOUPERT's avatar Yoann HOUPERT
Browse files

allow transcript one file

parent 975aed90
......@@ -49,5 +49,5 @@ COPY . .
RUN ./deploy-offline-decoding.sh /opt/kaldi /opt/lium_spkdiarization-8.4.1.jar /opt/models
# Set the default command
EXPOSE 5000
EXPOSE 4000
CMD ./LinSTT_webservice.py
\ No newline at end of file
......@@ -3,6 +3,8 @@
from StringIO import StringIO
from flask import Flask, request
from flask import send_file
from flask import jsonify
import linecache
import os
import subprocess
import wave
......@@ -12,11 +14,25 @@ app.secret_key = "Abdel"
@app.route('/upload', methods=['GET','POST'])
def upload():
if request.method == 'POST':
fichier=request.files['wav_file']
fichier=request.files['wavFile']
nom_fichier=fichier.filename
fichier.save('./wavs/'+nom_fichier)
subprocess.call("cd scripts; ./decode.sh ../systems/models", shell=True)
return send_file('trans/decode_'+nom_fichier.split('.')[0]+'/log/decode.1.log',mimetype="text/plain",as_attachment=True,)
return '<form action="" method="post" enctype="multipart/form-data"><input type="file" name="wav_file"/><input type="submit" value="Envoyer" /></form>'
subprocess.call("cd scripts; ./decode.sh ../systems/models "+nom_fichier, shell=True)
data = {}
json = ""
with open('trans/decode_'+nom_fichier.split('.')[0]+'.log', "r") as fp:
line = fp.readline()
json +=line.strip()
while line:
line = fp.readline()
json +=line.strip()
data['transcript'] = json
return jsonify(data);
return '<form action="" method="post" enctype="multipart/form-data"><input type="file" name="wavFile"/><input type="submit" value="Envoyer" /></form>'
if __name__=='__main__':
app.run(host='0.0.0.0')
if "NB_PROCESS" in os.environ:
app.run(host='0.0.0.0', processes=int(os.environ['NB_PROCESS']))
else:
app.run(host='0.0.0.0',threaded=True)
\ No newline at end of file
......@@ -12,11 +12,12 @@ num_threads=1
sysdir=$(readlink -f $1)
doScoring=0
stage=1
curentFile=$2
file="$wavdir/$curentFile"
sysRootName=$(echo $(basename $sysdir)|cut -f1 -d"=")
for file in $(find $wavdir -name "*.wav");do
fileRootName=$(basename $file .wav)
datadir=$lvcsrRootDir/kaldi_input_data/$fileRootName
[ -d $datadir ] || mkdir -p $datadir
if [ $stage -le 0 ]; then
......@@ -67,14 +68,14 @@ for file in $(find $wavdir -name "*.wav");do
$lvcsrRootDir/scripts/steps/decode_fmllr.sh --nj $decode_nj --cmd "$decode_cmd" --num-threads $num_threads --skip-scoring "true" \
$gmmdir/Graph $datadir $transdir || exit 1
fi
mv $transdir* $lvcsrRootDir/trans
mv $transdir $lvcsrRootDir/trans
cat $lvcsrRootDir/trans/decode_$fileRootName/log/decode.1.log | grep -v "#" | grep -v "LOG" | grep -v "gmm-latgen-faster" | grep -v "splice-feats" | grep -v "transform-feats" | grep -v "apply-cmvn" | awk '{$1=""; print $0}' | sed 's/^[ ]//' > $lvcsrRootDir/trans/decode_$fileRootName.log
fi
### for next sprint add
### fmllr Feature Extraction ####
### DNN Acoustic Models applied on top of the fmllr features ###
### Rescoring with LM
### Get CTM and STM files
done
echo "End...."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment