Skip to content

Commit

Permalink
Merge pull request #37 from exadel-inc/EFRS-1236-URL-malfuntioning
Browse files Browse the repository at this point in the history
Efrs 1236 url malfuntioning
  • Loading branch information
smchedlidze826 authored Jun 2, 2022
2 parents c3884f3 + 3ccf1c7 commit 6c3f943
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
45 changes: 40 additions & 5 deletions compreface.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
/*
* Copyright (c) 2020 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

declare interface Options {
limit: number,
prediction_count?: number,
face_plugins?: string,
det_prob_threshold?: number,
status?: boolean
}
declare interface FaceCollectionAddOptions {
det_prob_threshold: string
}

declare interface ServiceOptions{
limit: number,
face_plugins?: string,
det_prob_threshold?: number,
status?: boolean
}

declare interface Detection {
detect<T>(image_path: string, localOptions?: any): Promise<T>;
detect<T>(image_path: string, localOptions?: ServiceOptions): Promise<T>;
}

declare interface Verification {
verify<T>(source_image_path: string, target_image_path: string, options?: any): Promise<T>
verify<T>(source_image_path: string, target_image_path: string, options: ServiceOptions): Promise<T>
}

declare interface Recognition {
recognize<T>(image_path: string, options: Options): Promise<T>;
getFaceCollection(): FaceCollectionFunctions;
subjectFunctions(): SubjectFunctions;
}
Expand All @@ -24,15 +59,15 @@ declare interface FaceCollectionFunctions {
* @param {String} subject
* @returns {Promise}
*/
add<T>(image_path: string, subject: string, options?: any): Promise<T>;
add<T>(image_path: string, subject: string, options?: FaceCollectionAddOptions): Promise<T>;

/**
* Verify face from image
* @param {String} image_path
* @param {String} image_id
* @returns {Promise}
*/
verify<T>(image_path: string, image_id: string, options?: any): Promise<T>,
verify<T>(image_path: string, image_id: string, options?: Options): Promise<T>,

/**
* Delete image by id
Expand Down Expand Up @@ -100,7 +135,7 @@ declare interface SubjectFunctions {
}

export declare class CompreFace {
constructor(server: string, port: number, options?: any);
constructor(server: string, port: number, options?: Options);

/**
* Initialize RecognitionService instance
Expand Down
2 changes: 1 addition & 1 deletion face_founder_demo/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function App() {
setUploadedImage( myEvent.target.result )
let sendata = myEvent.target.result.split(',')[1];

recognitionService.recognize(sendata, { limit: 10, prediction_count: 100, face_plugins: "age,gender"})
recognitionService.recognize(sendata, {limit:10, prediction_count: 100, face_plugins: "age,gender"})
.then(res => {
setLoading(false)
setFullData(res.result[0].subjects);
Expand Down
4 changes: 4 additions & 0 deletions services/recognition_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class RecognitionService {
status: true
};

if (!options.limit) {
options = { ...options, limit: 0 };
}

// add parameters to basic url
let full_url = get_full_url(this.recognize_base_url, this.server, this.port)
let url = add_options_to_url(full_url, this.options, options, required_url_parameters);
Expand Down

0 comments on commit 6c3f943

Please sign in to comment.