mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 13:35:12 +03:00
update
This commit is contained in:
parent
8307b89ce2
commit
fddf475400
@ -1,7 +1,7 @@
|
||||
{
|
||||
"app_title": "voice-recorder",
|
||||
"storage_type":"local",
|
||||
"use_mel_spectrogram":false,
|
||||
"use_mel_spectrogram":true,
|
||||
"text": [
|
||||
{
|
||||
"title": "ITA-emotion",
|
||||
|
@ -29,22 +29,32 @@ app.debug = True
|
||||
def static_dir(path):
|
||||
return send_from_directory("../docs", path)
|
||||
|
||||
@app.route('/', methods=['GET'])
|
||||
def redirect_to_index():
|
||||
return send_from_directory("../frontend/dist", 'index.html')
|
||||
|
||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||
|
||||
@app.route('/api/voice/<string:title>/<string:prefix>/<int:index>', methods=['POST'])
|
||||
def post_voice(title, prefix, index):
|
||||
filename = f"{prefix}{index:03}.zip"
|
||||
data_dir = os.path.join(DATA_ROOT, title)
|
||||
os.makedirs(data_dir,exist_ok=True)
|
||||
fullpath = os.path.join(data_dir, filename)
|
||||
data = base64.b64decode(request.json['data'])
|
||||
f = open(fullpath, 'wb')
|
||||
f.write(data)
|
||||
f.close()
|
||||
data = {
|
||||
"message":"OK"
|
||||
}
|
||||
return jsonify(data)
|
||||
|
||||
try:
|
||||
filename = f"{prefix}{index:03}.zip"
|
||||
data_dir = os.path.join(DATA_ROOT, title)
|
||||
os.makedirs(data_dir,exist_ok=True)
|
||||
fullpath = os.path.join(data_dir, filename)
|
||||
data = base64.b64decode(request.json['data'])
|
||||
f = open(fullpath, 'wb')
|
||||
f.write(data)
|
||||
f.close()
|
||||
data = {
|
||||
"message":"OK"
|
||||
}
|
||||
return jsonify(data)
|
||||
except Exception as e:
|
||||
print("REQUEST PROCESSING!!!! EXCEPTION!!!", e)
|
||||
print(traceback.format_exc())
|
||||
return str(e)
|
||||
|
||||
@app.route('/api/voice/<string:title>/<string:prefix>/<int:index>', methods=['GET'])
|
||||
def get_voice(title, prefix, index):
|
||||
filename = f"{prefix}{index:03}.zip"
|
||||
@ -67,7 +77,6 @@ def get_voice(title, prefix, index):
|
||||
}
|
||||
return jsonify(data)
|
||||
|
||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||
|
||||
@app.after_request
|
||||
def after_request(response):
|
||||
|
25
template/setting_recorder_colab.json
Normal file
25
template/setting_recorder_colab.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"app_title": "voice-recorder",
|
||||
"storage_type":"server",
|
||||
"use_mel_spectrogram":true,
|
||||
"text": [
|
||||
{
|
||||
"title": "ITA-emotion",
|
||||
"wavPrefix": "emotion",
|
||||
"file": "./assets/text/ITA_emotion_all.txt",
|
||||
"file_hira": "./assets/text/ITA_emotion_all_hira.txt"
|
||||
},
|
||||
{
|
||||
"title": "ITA-recitation",
|
||||
"wavPrefix": "recitation",
|
||||
"file": "./assets/text/ITA_recitation_all.txt",
|
||||
"file_hira": "./assets/text/ITA_recitation_all_hira.txt"
|
||||
},
|
||||
{
|
||||
"title": "wagahaiwa",
|
||||
"wavPrefix": "wagahaiwa",
|
||||
"file": "./assets/text/wagahaiwa.txt",
|
||||
"file_hira": "./assets/text/wagahaiwa_hira.txt"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user