Skip to content

Commit 6c3f943

Browse files
Merge pull request #37 from exadel-inc/EFRS-1236-URL-malfuntioning
Efrs 1236 url malfuntioning
2 parents c3884f3 + 3ccf1c7 commit 6c3f943

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

compreface.d.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
1+
/*
2+
* Copyright (c) 2020 the original author or authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13+
* or implied. See the License for the specific language governing
14+
* permissions and limitations under the License.
15+
*/
16+
17+
declare interface Options {
18+
limit: number,
19+
prediction_count?: number,
20+
face_plugins?: string,
21+
det_prob_threshold?: number,
22+
status?: boolean
23+
}
24+
declare interface FaceCollectionAddOptions {
25+
det_prob_threshold: string
26+
}
27+
28+
declare interface ServiceOptions{
29+
limit: number,
30+
face_plugins?: string,
31+
det_prob_threshold?: number,
32+
status?: boolean
33+
}
34+
135
declare interface Detection {
2-
detect<T>(image_path: string, localOptions?: any): Promise<T>;
36+
detect<T>(image_path: string, localOptions?: ServiceOptions): Promise<T>;
337
}
438

539
declare interface Verification {
6-
verify<T>(source_image_path: string, target_image_path: string, options?: any): Promise<T>
40+
verify<T>(source_image_path: string, target_image_path: string, options: ServiceOptions): Promise<T>
741
}
842

943
declare interface Recognition {
44+
recognize<T>(image_path: string, options: Options): Promise<T>;
1045
getFaceCollection(): FaceCollectionFunctions;
1146
subjectFunctions(): SubjectFunctions;
1247
}
@@ -24,15 +59,15 @@ declare interface FaceCollectionFunctions {
2459
* @param {String} subject
2560
* @returns {Promise}
2661
*/
27-
add<T>(image_path: string, subject: string, options?: any): Promise<T>;
62+
add<T>(image_path: string, subject: string, options?: FaceCollectionAddOptions): Promise<T>;
2863

2964
/**
3065
* Verify face from image
3166
* @param {String} image_path
3267
* @param {String} image_id
3368
* @returns {Promise}
3469
*/
35-
verify<T>(image_path: string, image_id: string, options?: any): Promise<T>,
70+
verify<T>(image_path: string, image_id: string, options?: Options): Promise<T>,
3671

3772
/**
3873
* Delete image by id
@@ -100,7 +135,7 @@ declare interface SubjectFunctions {
100135
}
101136

102137
export declare class CompreFace {
103-
constructor(server: string, port: number, options?: any);
138+
constructor(server: string, port: number, options?: Options);
104139

105140
/**
106141
* Initialize RecognitionService instance

face_founder_demo/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function App() {
8080
setUploadedImage( myEvent.target.result )
8181
let sendata = myEvent.target.result.split(',')[1];
8282

83-
recognitionService.recognize(sendata, { limit: 10, prediction_count: 100, face_plugins: "age,gender"})
83+
recognitionService.recognize(sendata, {limit:10, prediction_count: 100, face_plugins: "age,gender"})
8484
.then(res => {
8585
setLoading(false)
8686
setFullData(res.result[0].subjects);

services/recognition_service.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ class RecognitionService {
4444
status: true
4545
};
4646

47+
if (!options.limit) {
48+
options = { ...options, limit: 0 };
49+
}
50+
4751
// add parameters to basic url
4852
let full_url = get_full_url(this.recognize_base_url, this.server, this.port)
4953
let url = add_options_to_url(full_url, this.options, options, required_url_parameters);

0 commit comments

Comments
 (0)