@joliegg/moderation 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/src/index.ts +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare class ModerationClient {
|
|
|
29
29
|
* Returns a list of moderation categories detected on an image
|
|
30
30
|
*
|
|
31
31
|
* @param {string} url
|
|
32
|
-
* @param {number} [minimumConfidence =
|
|
32
|
+
* @param {number} [minimumConfidence = 50] The minimum confidence required for a category to be considered
|
|
33
33
|
*
|
|
34
34
|
*
|
|
35
35
|
* @returns {Promise<ModerationResult[]>} The list of results that were detected with the minimum confidence specified
|
package/dist/index.js
CHANGED
|
@@ -88,12 +88,12 @@ class ModerationClient {
|
|
|
88
88
|
* Returns a list of moderation categories detected on an image
|
|
89
89
|
*
|
|
90
90
|
* @param {string} url
|
|
91
|
-
* @param {number} [minimumConfidence =
|
|
91
|
+
* @param {number} [minimumConfidence = 50] The minimum confidence required for a category to be considered
|
|
92
92
|
*
|
|
93
93
|
*
|
|
94
94
|
* @returns {Promise<ModerationResult[]>} The list of results that were detected with the minimum confidence specified
|
|
95
95
|
*/
|
|
96
|
-
async moderateImage(url, minimumConfidence =
|
|
96
|
+
async moderateImage(url, minimumConfidence = 50) {
|
|
97
97
|
if (typeof this.rekognitionClient === 'undefined') {
|
|
98
98
|
return { source: url, moderation: [] };
|
|
99
99
|
}
|
|
@@ -116,6 +116,7 @@ class ModerationClient {
|
|
|
116
116
|
},
|
|
117
117
|
MinConfidence: minimumConfidence
|
|
118
118
|
});
|
|
119
|
+
console.log(ModerationLabels);
|
|
119
120
|
if (Array.isArray(ModerationLabels)) {
|
|
120
121
|
const moderation = ModerationLabels.map(l => ({
|
|
121
122
|
category: l.Name ?? 'Unknown',
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -111,12 +111,12 @@ class ModerationClient {
|
|
|
111
111
|
* Returns a list of moderation categories detected on an image
|
|
112
112
|
*
|
|
113
113
|
* @param {string} url
|
|
114
|
-
* @param {number} [minimumConfidence =
|
|
114
|
+
* @param {number} [minimumConfidence = 50] The minimum confidence required for a category to be considered
|
|
115
115
|
*
|
|
116
116
|
*
|
|
117
117
|
* @returns {Promise<ModerationResult[]>} The list of results that were detected with the minimum confidence specified
|
|
118
118
|
*/
|
|
119
|
-
async moderateImage (url: string, minimumConfidence: number =
|
|
119
|
+
async moderateImage (url: string, minimumConfidence: number = 50): Promise<ModerationResult> {
|
|
120
120
|
if (typeof this.rekognitionClient === 'undefined') {
|
|
121
121
|
return { source: url, moderation: [] };
|
|
122
122
|
}
|
|
@@ -142,6 +142,8 @@ class ModerationClient {
|
|
|
142
142
|
MinConfidence: minimumConfidence
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
+
console.log(ModerationLabels);
|
|
146
|
+
|
|
145
147
|
if (Array.isArray(ModerationLabels)) {
|
|
146
148
|
const moderation = ModerationLabels.map(l => ({
|
|
147
149
|
category: l.Name ?? 'Unknown',
|