Commit 564e9b76 authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

some changes

parent 61a81548
......@@ -68,22 +68,27 @@ def getColorActivitiesResult():
@app.route("/predict", methods=["POST"])
def predict():
data = request.get_json()
print((f"{data}"))
fileitem = data['uri']
# if fileitem.filename:
# # strip the leading path from the file name
fn = os.path.basename(fileitem)
#
# # open read and write the file into the server
open(fn, 'wb').write(fileitem.file.read())
resp = make_response(request.get_json())
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Content-Type'] = 'application/json'
return resp
try:
data = request.get_json()
fileitem = data['uri']
colorName = data['colorNmae']
# print((f"{colorName}"))
# if fileitem.filename:
# # strip the leading path from the file name
fn = os.path.basename(fileitem)
#
# # open read and write the file into the server
# open(fn, 'wb').write(fileitem.file.read())
resp = make_response(request.get_json())
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Content-Type'] = 'application/json'
return resp
except ValueError:
print(ValueError)
# get audio file and save it
# audio_file = request.files["file"]
......
......@@ -94,25 +94,12 @@ export default function Blue(color) {
const formData = new FormData();
var obj = {
uri: `file://${audioFile}`,
uri: `file:${audioFile}`,
type: 'audio/wav',
name: 'color.wav',
colorNmae: backColor
}
// formData.append(
// 'file',
// {
// uri: `file://${audioFile}`,
// type: 'audio/wav',
// name: 'color.wav',
// }
// );
// formData.append(
// 'name', backColor
// );
var data = JSON.stringify(obj)
console.log(data);
......
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