나의 AI Human 만들기
이어서, 기본(default) AI Human 모델로 AIPlayer
객체를 생성하고 AI 발화 절차에 대해 알아봅니다. AIPlayer
가 처음 초기화될 때 네트워 크 상태에 따라 모델 리소스 로딩을 하는 데 몇 분이 걸릴 수도 있습니다.
참고로 아래 내용은 AI Human 웹사이트에서 다운로드 받을 수 있는 Sample Project의 QuickStart 부분과 유사합니다.

정보
Sample Project에서 아래 파일들을 참고하세요.
- QuickStartView.xaml
- QuickStartViewModel.cs
1. View Control 추가하기
AIPlayer
의 View(UserControl) 바인딩할 Control(ContentControl)을 MainWindow.xaml에 추가합니다.
AI Human을 동작하게 하는 View를 AIPlayerView
라고 합니다.
AI Human 모델을 표시할 위치, 즉 Application에서 AIPlayerView
를 배치할 위치를 지정합니다.


2. Authenticate 함 수를 이용하여 인증하기
아래 코드를 참고하여 Application 초기화 시 SDK 인증 관련 코드를 작성하세요.
-
App.xaml.cs
SDK 구동을 위해 가장 먼저 인증 과정이 필요합니다.
USERKEY
는 AI Human 웹사이트에서APPID
를 등록하면 발급받을 수 있습니다.
using AIHuman.Core;
using AIHuman.Utils;
using System.Windows;
namespace WpfApp1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
/// TODO: You must assign APPID and USERKEY.
/// DOCS: https://docs.aistudios.com/aihuman/windows-sdk/getting-started/projectsetup
/// <see cref="APPID"/> is a unique ID of the project(application ID).
/// <see cref="USERKEY"/> can be obtained by creating a project on the AIHuman Website and registering the App ID.
private string APPID = "";
private string USERKEY ="";
public App()
{
AIAPI.Instance.Authenticate(APPID, USERKEY, (aiLIst, error) => {
if (error == null && aiLIst != null)
{
Log.Write($"Authenticate Completed, Available Count: {aiLIst.ai.Length}", Log.Level.Info);
}
else
{
Log.Write($"Authenticate Failed: {error}", Log.Level.Error);
}
});
}
}
}