From ae70b5dc286091e5770ed4c8d62f01ec2bb3e730 Mon Sep 17 00:00:00 2001 From: Alexander James Wallar Date: Mon, 20 Jan 2014 13:49:03 -0500 Subject: [PATCH] Added confidence when in the NotifyResponse --- app/Locabean/src/com/locaudio/api/NotifyResponse.java | 3 +++ locaudio/api.py | 2 +- locaudio/detectionserver.py | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Locabean/src/com/locaudio/api/NotifyResponse.java b/app/Locabean/src/com/locaudio/api/NotifyResponse.java index 843e9ca..4f845bc 100644 --- a/app/Locabean/src/com/locaudio/api/NotifyResponse.java +++ b/app/Locabean/src/com/locaudio/api/NotifyResponse.java @@ -11,4 +11,7 @@ public class NotifyResponse { @SerializedName("name") public String name; + + @SerializedName("confidence") + public float confidence; } diff --git a/locaudio/api.py b/locaudio/api.py index 543968d..21740ed 100644 --- a/locaudio/api.py +++ b/locaudio/api.py @@ -56,6 +56,6 @@ def notify_event(self, data): req = urllib2.Request(url=self.notify_url, data=encdata) res = urllib2.urlopen(req) - return res.read() + return json.loads(res.read()) diff --git a/locaudio/detectionserver.py b/locaudio/detectionserver.py index bd56c61..5b8d88b 100644 --- a/locaudio/detectionserver.py +++ b/locaudio/detectionserver.py @@ -73,7 +73,12 @@ def post_notify(): request_to_detection_event(request.form, confidence) ) - return jsonify(error=0, message="No error", name=sound_name) + return jsonify( + error=0, + message="No error", + name=sound_name, + confidence=confidence + ) @config.app.route("/locations/", methods=["GET"])