0

我正在使用python sdk用於使用Microsoft認知服務的說話人識別[我正在識別文件夾]中;當我運行CreateProfile.py文件時,我試圖給一個配置文件一個用戶名。例如,我會運行我的main.py文件,然後嘗試通過語言環境和名稱Azure揚聲器識別 - 如何將新密鑰/值添加到用戶配置文件?

import sys 
sys.path.append('./Identification') 
from CreateProfile import create_profile 

name="Jane Doe" 
subscriptionKey = "<my subscription key>" 
locale = "en-us" 

create_profile(name, subscriptionKey, locale) 

一旦我運行get配置文件GetProfile.py我希望它輸出所有用戶的信息,包括他們的用戶名。但我得到這在終端返回。

Profile Name = None 
Profile ID = 93affed1-ceb2-4538-9e6b-f0bd22d123b0 
Locale = en-us 
Enrollments Speech Time = 0.0 
Remaining Enrollment Time = 30.0 
Created = 2017-10-07T02:03:51.956Z 
Last Action = 2017-10-07T02:03:51.956Z 
Enrollment Status = Enrolling 

我已經嘗試通過在類中添加的東西像_PROFILE_NAME = 'identificationProfileName'編輯IdentificationProfile.py,我已在很多地方與此相關的一個變化,但我還是不看名字返回時我跑GetProfile.py

這是我IdentificationProfile.py

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 Name = {0}\n Profile ID = {1}\nLocale = {2}\nEnrollments Speech Time = {3}\nRemaining Enrollment Time = {4}\nCreated = {5}\nLast Action = {6}\nEnrollment Status = {7}\nName\n'.format(
     profile._profile_name, 
     profile._profile_id, 
     profile._locale, 
     profile._name, 
     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]) 

回答

1

你不能給一個名稱,一個標識卡。 Python SDK使用的HTTP endpoint不接受語音區域設置以外的任何參數。

您必須自己將用戶名映射到標識配置文件ID。你可以使用一個數據庫,可能是Azure MySQL db。或者,如果您只是測試一下,請使用內存映射(又名詞典)。

相關問題