com.rest.huggingface
1.0.0
Unity Game Engine的非官方擁抱Face Fastful客戶端。
我不隸屬於擁抱面,需要帶有API訪問的帳戶。
所有版權,商標,徽標和資產都是其各自所有者的財產。
需要統一2021.3 LT或更高。
推薦的安裝方法是Unity軟件包管理器和OpenUPM。
Package Manager
OpenUPMhttps://package.openupm.comcom.rest.huggingfacecom.utilitiesMy RegistriesHuggingFace麵包https://github.com/RageAgainstThePixel/com.rest.huggingface.git#upm注意:此存儲庫對其他存儲庫有依賴性!您有責任自己添加它們。
有4種提供您的API鍵的方法,按優先順序:
var api = new HuggingFaceClient ( " yourApiKey " ) ;或手動創建一個HuggingFaceAuthentication對象
var api = new HuggingFaceClient ( new HuggingFaceAuthentication ( " yourApiKey " ) ) ; 您可以將密鑰直接保存到Assets/Resources文件夾中的可腳本對像中。
您可以使用Project Pane的上下文菜單創建一個新的,並創建一個新的HuggingFaceConfiguration腳本對象。

嘗試從配置文件中加載API鍵,默認情況下,在當前目錄中.huggingface 。
要創建一個配置文件,請創建一個名為.huggingface並包含該行的新文本文件:
{
"apiKey" : " yourApiKey " ,
}您還可以通過調用身份驗證中的靜態方法直接加載文件:
var api = new HuggingFaceClient ( new HuggingFaceAuthentication ( ) . LoadFromDirectory ( " your/path/to/.huggingface " ) ) ; ; 使用系統的環境變量指定使用的API鍵。
HUGGING_FACE_API_KEY用於API鍵。 var api = new HuggingFaceClient ( new HuggingFaceAuthentication ( ) . LoadFromEnvironment ( ) ) ;托多
托多