App 1 Icon
imToken: BTC & ETH
下載
App 2 Icon
imToken: BTC & ETH
下載
App 3 Icon
imToken: BTC & ETH
下載

国模无码一区二区三区,国产情侣久久久久aⅴ免费,成人做爰免费视频免费看,亚洲一区域二区域三区域四区域

結合GPT與元宇宙技術打造虛擬人直播:詳細開發(fā)流程與無人直播場景應用

圖片

無人直播領域,虛擬主播的需求持續(xù)上升,如何迅速實現(xiàn)虛擬主播的直播功能,已成為眾人關注的焦點。接下來,我們將詳細闡述其開發(fā)步驟。

必備能力解析

圖片

GPT4.0虛擬人直播具備兩項基本功能。首先,它通過GPT4.0接口實現(xiàn),目前openAI提供的是GPT3.5接口,可以直接使用。其次,虛擬人具備交互功能,bing在新版Edge瀏覽器中加入了GPT4.0體驗,同時也有開源庫進行二次封裝,只需提供Cookie即可體驗。在Edge瀏覽器中,要獲取Cookie,請按F12鍵進入開發(fā)者工具,切換到應用程序標簽頁,然后在左側的Cookie列表中找到并查看_U的值。

npm i @waylaidwanderer/chatgpt-api

import { BingAIClient } from '@waylaidwanderer/chatgpt-api';
export class BingGPT {
/*
* http_proxy, apiKey
**/
constructor(http_proxy, userCookie) {
this.api = this.init(http_proxy, userCookie);
}
init(http_proxy, userCookie) {
console.log(http_proxy, userCookie)
const options = {
// Necessary for some people in different countries, e.g. China (https://cn.bing.com)
host: 'https://www.bing.com',
// "_U" cookie from bing.com
userToken: userCookie,
// If the above doesn't work, provide all your cookies as a string instead
cookies: '',
// A proxy string like "http://:"
proxy: http_proxy,
// (Optional) Set to true to enable `console.debug()` logging
debug: false,
};

return new BingAIClient(options);
}
//調用chatpgt
chat(text, cb) {
var res=""
var that = this;
console.log("正在向bing發(fā)送提問", text )
this.api.sendMessage(text, {
toneStyle: 'balanced',
onProgress: (token) => {
if(token.length==2 && token.charCodeAt(0)==55357&&token.charCodeAt(1)==56842){
cb(true, res);
}
res+=token;
}
});
}
}

接口選擇考量

GPT4.0依賴瀏覽器,其非官方API不夠穩(wěn)定。因此,我們選擇了即構Avatar。這個軟件內置了文本驅動功能,能夠將GPT的回復文字朗讀出來,并且具備口型匹配功能。通過簡單幾行代碼,我們就能定制虛擬人的“皮膚”,使用起來非常便捷。不過,使用即構Avatar需要進行權限認證和引擎初始化等步驟。文末的代碼附件可供參考。

圖片

體驗功能拓展

npm install chatgpt

npm install https-proxy-agent node-fetch

官方提供的演示版本源代碼僅包含基礎資源,而構Avatar在捏臉功能上同樣出色。有興趣的朋友可以訪問官方網站下載并體驗app,親自體驗它的強大之處。該軟件能夠為虛擬人物塑造出豐富多彩的形象,滿足各種直播場合的需求。

import { ChatGPTAPI } from "chatgpt";
import proxy from "https-proxy-agent";
import nodeFetch from "node-fetch";

export class ChatGPT {

constructor(http_proxy, apiKey) {
this.api = this.init(http_proxy, apiKey);
this.conversationId = null;
this.ParentMessageId = null;
}
init(http_proxy, apiKey) {
console.log(http_proxy, apiKey)
return new ChatGPTAPI({
apiKey: apiKey,
fetch: (url, options = {}) => {
const defaultOptions = {
agent: proxy(http_proxy),
};

const mergedOptions = {
...defaultOptions,
...options,
};

return nodeFetch(url, mergedOptions);
},
});
}
//調用chatpgt
chat(text, cb) {
let that = this
console.log("正在向ChatGPT發(fā)送提問:", text)
that.api.sendMessage(text, {
conversationId: that.ConversationId,
parentMessageId: that.ParentMessageId
}).then(
function (res) {
that.ConversationId = res.conversationId
that.ParentMessageId = res.id
cb && cb(true, res.text)
}
).catch(function (err) {
console.log(err)
cb && cb(false, err);
});
}
}

平臺推流手段

圖片

在B站、抖音、快手等第三方平臺上進行虛擬直播時,需要使用官方提供的推流工具,比如直播伴侶。但是,官方并未提供獲取直播間評論或彈幕的實時接口,若要實現(xiàn)這一功能,需要借助一些技術方法,這里就不詳細說明了。

自建平臺思路

private void setCharacter(User user) {
String sex = ZegoCharacterHelper.MODEL_ID_MALE;
if (!user.isMan) sex = ZegoCharacterHelper.MODEL_ID_FEMALE;

// 創(chuàng)建 helper 簡化調用
// base.bundle 是頭模, human.bundle 是全身人模
mCharacterHelper = new ZegoCharacterHelper(FileUtils.getPhonePath(mApp, "human.bundle", "assets"));
mCharacterHelper.setExtendPackagePath(FileUtils.getPhonePath(mApp, "Packages", "assets"));
// 設置形象配置
mCharacterHelper.setDefaultAvatar(sex);
// 角色上屏, 必須在 UI 線程, 必須設置過avatar形象后才可調用(用 setDefaultAvatar 或者 setAvatarJson 都可以)
mCharacterHelper.setCharacterView(user.avatarView, () -> {
});
mCharacterHelper.setViewport(ZegoAvatarViewState.half);
//設置頭發(fā)、衣服等
mCharacterHelper.setPackage("ZEGO_Girl_Hair_0001");
mCharacterHelper.setPackage("ZEGO_Girl_Tshirt_0001_0002");
mCharacterHelper.setPackage("facepaint5");
mCharacterHelper.setPackage("irises2");

initTextApi();
updateUser(user);
}

不依賴第三方平臺,自行構建直播平臺同樣可行。通過即構的實時音視頻技術RTC,主播可以實時傳輸手機畫面,觀眾也能同步接收圖像。此前,基于抖音平臺開發(fā)的虛擬人直播演示,B站、快手等平臺采用的原理相似。虛擬人通過用戶端的固定算法進行渲染,與主播現(xiàn)場拍攝的畫面存在一定差異。

public void playText(String text) {
if (mTextApi == null) return;
mTextApi.playTextExpression(text);
}

成本優(yōu)勢方案

即構ZIM具備全面的即時通訊功能,涵蓋一對一聊天、多人群聊以及房間內交流,可根據(jù)需求靈活搭配。在虛擬直播場景中,文字信息實時傳輸至各終端,再本地生成畫面,這種方式成本最低。直播間可利用房間管理功能,而在即構IM的房間中,用戶可以通過彈幕功能發(fā)送和接收文字信息。

看完這段,大家對虛擬人直播的制作步驟是否已經明了?接下來,你打算將這些建議用于哪些無人直播的場合?歡迎在評論區(qū)留言交流!別忘了點贊和轉發(fā)這篇文章。

圖片

圖片

作者頭像
imtoken官網2025創(chuàng)始人

imtoken官網2025

上一篇:六位KOL今日推薦幣種及Uniswap正式發(fā)布協(xié)議代幣UNI的詳細解讀
下一篇:中國人民銀行數(shù)字貨幣研究所所長穆長春談數(shù)字人民幣發(fā)展道路與金融強國建設
主站蜘蛛池模板: 木兰县| 浠水县| 红桥区| 阳原县| 蛟河市| 伽师县| 高邑县| 民权县| 界首市| 山阴县| 白沙| 桂东县| 监利县| 武功县| 黄骅市| 怀仁县| 庄河市| 广饶县| 孝义市| 大新县| 阜阳市| 衢州市| 双桥区| 赤峰市| 虹口区| 蒙阴县| 江口县| 鄯善县| 双牌县| 宁晋县| 宜兰县| 新泰市| 乌兰县| 肃南| 盐亭县| 保定市| 陇西县| 高平市| 阳山县| 小金县| 波密县|