-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from naeem1997/master
Master
- Loading branch information
Showing
877 changed files
with
32,843 additions
and
209,524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,9 @@ awscli-bundle/install | |
SpeakerRecognition/instance/config.py | ||
|
||
config.py | ||
|
||
env/ | ||
source/ | ||
bin/ | ||
|
||
*.xlsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Create a user profile: python Identification\CreateProfile.py <subscription_key> | ||
Print all user profiles: python Identification\PrintAllProfiles.py <subscription_key> | ||
Enroll user profiles: python Identification\EnrollProfile.py <subscription_key> <profile_id> | ||
<enrollment_file_path> <force_short_audio> | ||
Identify test files: python Identification\IdentifyFile.py <subscription_key> <identification_file_path> <profile_ids>... | ||
|
||
|
||
6892b3e9442a40b38a9c84a75f0cc273 | ||
|
||
|
||
Profile ID = 2997cb3a-cb31-4233-a1f9-5992b586f72f --> 0010_speaker1 audio flag: True | ||
Profile ID = 34ec3498-55cb-42d2-ad3c-e426e0b7dbef --> 0039_speaker2- audio flag: True | ||
|
||
728872b36b74400490650fe577ab5772 | ||
|
||
Profile ID = 60c5cfa6-f27b-4f6f-85b0-ecad28a951b9 --> 0010 audio flag: False | ||
Profile ID = 3269cbca-dd1f-4cf4-ab93-374cc32b67ff --? 0038 audio flag- False | ||
|
||
Profile ID = 29a3e0af-7286-444b-8122-c15fd410bdf5 --> 0010 audio flag | ||
|
||
863e8910-0258-4af0-b847-ea65ae2d2f53 | ||
|
||
|
||
"identificationProfileId": "e770227b-25bb-4a8b-bd1e-2ca004af5b5a" | ||
|
||
|
||
728872b36b74400490650fe577ab5772 | ||
|
||
Profile ID = af68c802-5b8d-4f35-9b53-e3db51dd9003 (waqas) | ||
Profile ID = ec364f7c-9aad-4a0b-beff-5b6570751b95 (faraz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import IdentificationServiceHttpClientHelper | ||
import sys | ||
|
||
def create_profile(subscription_key, locale): | ||
"""Creates a profile on the server. | ||
Arguments: | ||
subscription_key -- the subscription key string | ||
locale -- the locale string | ||
""" | ||
helper = IdentificationServiceHttpClientHelper.IdentificationServiceHttpClientHelper( | ||
subscription_key) | ||
|
||
creation_response = helper.create_profile(locale) | ||
|
||
print('Profile ID = {0}'.format(creation_response.get_profile_id())) | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 2: | ||
print('Usage: python CreateProfile.py <subscription_key>') | ||
print('\t<subscription_key> is the subscription key for the service') | ||
sys.exit('Error: Incorrect Usage.') | ||
|
||
create_profile(sys.argv[1], 'en-us') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import IdentificationServiceHttpClientHelper | ||
import sys | ||
|
||
|
||
def delete_profile(subscription_key, profile_id): | ||
""" Deletes a profile from the server | ||
Arguments: | ||
profile_id -- the profile ID string of user to delete | ||
""" | ||
helper = IdentificationServiceHttpClientHelper.IdentificationServiceHttpClientHelper( | ||
subscription_key) | ||
helper.delete_profile(profile_id) | ||
|
||
print('Profile {0} has been successfully deleted.'.format(profile_id)) | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 3: | ||
print('Usage: python DeleteProfile.py <subscription_key> <profile_id> ') | ||
print('\t<subscription_key> is the subscription key for the service') | ||
print('\t<profile_id> the ID for a profile to delete from the sevice') | ||
sys.exit('Error: Incorrect usage.') | ||
|
||
delete_profile(sys.argv[1], sys.argv[2]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import IdentificationServiceHttpClientHelper | ||
import sys | ||
|
||
def enroll_profile(subscription_key, profile_id, file_path, force_short_audio): | ||
"""Enrolls a profile on the server. | ||
Arguments: | ||
subscription_key -- the subscription key string | ||
profile_id -- the profile ID of the profile to enroll | ||
file_path -- the path of the file to use for enrollment | ||
force_short_audio -- waive the recommended minimum audio limit needed for enrollment | ||
""" | ||
helper = IdentificationServiceHttpClientHelper.IdentificationServiceHttpClientHelper( | ||
subscription_key) | ||
|
||
enrollment_response = helper.enroll_profile( | ||
profile_id, | ||
file_path, | ||
force_short_audio.lower() == "true") | ||
|
||
print('Total Enrollment Speech Time = {0}'.format(enrollment_response.get_total_speech_time())) | ||
print('Remaining Enrollment Time = {0}'.format(enrollment_response.get_remaining_speech_time())) | ||
print('Speech Time = {0}'.format(enrollment_response.get_speech_time())) | ||
print('Enrollment Status = {0}'.format(enrollment_response.get_enrollment_status())) | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 5: | ||
print('Usage: python EnrollProfile.py <subscription_key> <profile_id> ' | ||
'<enrollment_file_path>') | ||
print('\t<subscription_key> is the subscription key for the service') | ||
print('\t<profile_id> is the profile ID of the profile to enroll') | ||
print('\t<enrollment_file_path> is the enrollment audio file path') | ||
print('\t<force_short_audio> True/False waives the recommended minimum audio limit needed ' | ||
'for enrollment') | ||
|
||
sys.exit('Error: Incorrect Usage.') | ||
|
||
enroll_profile(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
class EnrollmentResponse: | ||
"""This class encapsulates the enrollment response.""" | ||
|
||
_TOTAL_SPEECH_TIME = 'enrollmentSpeechTime' | ||
_REMAINING_SPEECH_TIME = 'remainingEnrollmentSpeechTime' | ||
_SPEECH_TIME = 'speechTime' | ||
_ENROLLMENT_STATUS = 'enrollmentStatus' | ||
|
||
def __init__(self, response): | ||
"""Constructor of the EnrollmentResponse class. | ||
Arguments: | ||
response -- the dictionary of the deserialized python response | ||
""" | ||
self._total_speech_time = response.get(self._TOTAL_SPEECH_TIME, None) | ||
self._remaining_speech_time = response.get(self._REMAINING_SPEECH_TIME, None) | ||
self._speech_time = response.get(self._SPEECH_TIME, None) | ||
self._enrollment_status = response.get(self._ENROLLMENT_STATUS, None) | ||
|
||
def get_total_speech_time(self): | ||
"""Returns the total enrollment speech time""" | ||
return self._total_speech_time | ||
|
||
def get_remaining_speech_time(self): | ||
"""Returns the remaining enrollment speech time""" | ||
return self._remaining_speech_time | ||
|
||
def get_speech_time(self): | ||
"""Returns the speech time for this enrollment""" | ||
return self._speech_time | ||
|
||
def get_enrollment_status(self): | ||
"""Returns the enrollment status""" | ||
return self._enrollment_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
|
||
import IdentificationServiceHttpClientHelper | ||
import sys | ||
|
||
|
||
def get_profile(subscription_key, profile_id): | ||
"""Get a speaker's profile with given profile ID | ||
Arguments: | ||
subscription_key -- the subscription key string | ||
profile_id -- the profile ID of the profile to resets | ||
""" | ||
helper = IdentificationServiceHttpClientHelper.IdentificationServiceHttpClientHelper( | ||
subscription_key) | ||
|
||
profile = helper.get_profile(profile_id) | ||
|
||
print('Profile ID = {0}\nLocale = {1}\nEnrollments Speech Time = {2}\nRemaining Enrollment Time = {3}\nCreated = {4}\nLast Action = {5}\nEnrollment Status = {6}\n'.format( | ||
profile._profile_id, | ||
profile._locale, | ||
profile._enrollment_speech_time, | ||
profile._remaining_enrollment_time, | ||
profile._created_date_time, | ||
profile._last_action_date_time, | ||
profile._enrollment_status)) | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 3: | ||
print('Usage: python DeleteProfile.py <subscription_key> <profile_id> ') | ||
print('\t<subscription_key> is the subscription key for the service') | ||
print('\t<profile_id> the ID for a profile to delete from the sevice') | ||
sys.exit('Error: Incorrect usage.') | ||
get_profile(sys.argv[1], sys.argv[2]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
|
||
class IdentificationProfile: | ||
"""This class encapsulates a user profile.""" | ||
|
||
_PROFILE_ID = 'identificationProfileId' | ||
_LOCALE = 'locale' | ||
_ENROLLMENT_SPEECH_TIME = 'enrollmentSpeechTime' | ||
_REMAINING_ENROLLMENT_TIME = 'remainingEnrollmentSpeechTime' | ||
_CREATED_DATE_TIME = 'createdDateTime' | ||
_LAST_ACTION_DATE_TIME = 'lastActionDateTime' | ||
_ENROLLMENT_STATUS = 'enrollmentStatus' | ||
|
||
def __init__(self, response): | ||
"""Constructor of the IdentificationProfile class. | ||
Arguments: | ||
response -- the dictionary of the deserialized python response | ||
""" | ||
self._profile_id = response.get(self._PROFILE_ID, None) | ||
self._locale = response.get(self._LOCALE, None) | ||
self._enrollment_speech_time = response.get(self._ENROLLMENT_SPEECH_TIME, None) | ||
self._remaining_enrollment_time = response.get(self._REMAINING_ENROLLMENT_TIME, None) | ||
self._created_date_time = response.get(self._CREATED_DATE_TIME, None) | ||
self._last_action_date_time = response.get(self._LAST_ACTION_DATE_TIME, None) | ||
self._enrollment_status = response.get(self._ENROLLMENT_STATUS, None) | ||
|
||
def get_profile_id(self): | ||
"""Returns the profile ID of the user""" | ||
return self._profile_id | ||
|
||
def get_locale(self): | ||
"""Returns the locale of the user""" | ||
return self._locale | ||
|
||
def get_enrollment_speech_time(self): | ||
"""Returns the total enrollment speech time of the user""" | ||
return self._enrollment_speech_time | ||
|
||
def get_remaining_enrollment_time(self): | ||
"""Returns the remaining enrollment speech time of the user""" | ||
return self._remaining_enrollment_time | ||
|
||
def get_created_date_time(self): | ||
"""Returns the creation date time of the user""" | ||
return self._created_date_time | ||
|
||
def get_last_action_date_time(self): | ||
"""Returns the last action date time of the user""" | ||
return self._last_action_date_time | ||
|
||
def get_enrollment_status(self): | ||
"""Returns the enrollment status of the user""" | ||
return self._enrollment_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
class IdentificationResponse: | ||
"""This class encapsulates the identification response.""" | ||
|
||
_IDENTIFIED_PROFILE_ID = 'identifiedProfileId' | ||
_CONFIDENCE = 'confidence' | ||
|
||
def __init__(self, response): | ||
"""Constructor of the IdentificationResponse class. | ||
Arguments: | ||
response -- the dictionary of the deserialized python response | ||
""" | ||
self._identified_profile_id = response.get(self._IDENTIFIED_PROFILE_ID, None) | ||
self._confidence = response.get(self._CONFIDENCE, None) | ||
|
||
def get_identified_profile_id(self): | ||
"""Returns the identified profile ID""" | ||
return self._identified_profile_id | ||
|
||
def get_confidence(self): | ||
"""Returns the identification confidence""" | ||
return self._confidence |
Oops, something went wrong.