-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавил фронтенд и оптимизировал работу декодера и пунктуатора на бэк…
…енде
- Loading branch information
Showing
145 changed files
with
5,989 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import configparser | ||
from decoder import TrieDecoder | ||
from flask import Flask, request | ||
import json | ||
import numpy as np | ||
|
||
|
||
config = configparser.ConfigParser() | ||
config.read("config.ini", encoding="UTF-8") | ||
lexicon = config["Wav2Letter"]["lexicon"] | ||
tokens = config["Wav2Letter"]["tokens"] | ||
lm_path = config["Wav2Letter"]["lm_path"] | ||
beam_threshold = float(config["Wav2Letter"]["beam_threshold"]) | ||
decoder = TrieDecoder(lexicon, tokens, lm_path, beam_threshold) | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route("/decode", methods=["POST"]) | ||
def decode(): | ||
data = request.json | ||
outputs = np.array(data["outputs"]) | ||
result = decoder.decode(outputs, start_timestamp=data["start_timestamp"]) | ||
|
||
results = { | ||
"text": result.text, | ||
"score": result.score, | ||
"words": result.words | ||
} | ||
|
||
return json.dumps(results, ensure_ascii=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.