Hi all! When running audio2face app headlessly, I am trying to change the emotion through API call from an extension created in audio2face app, but not able to see those changes as the audio2face app goes to not responding state. I have tried to do the same with the swagger doc and external scripts outside of audio2face app, which is working fine. Can I do it from an customized extension in audio2face app?
Hi @sagar.singh
the restAPi is mainly for communicating with the Audio2face from the outside. Trying to use requests or a subprocess call from within will indeed freeze the app.
You can use “omni.services.client” instead
Add the following dependecies to in your extension.toml file
"omni.services.core"={}
"omni.services.client"={}
then in your extension you can use :
import asyncio
from omni.services.client import AsyncClient
from omni.services.core import main
async def test_API_calls(self):
client = AsyncClient("local://", app=main.get_app())
response = await getattr(client, "A2F/GetInstances")()
response = await getattr(client, "A2F/Player/SetTime")(a2f_player="/World/audio2face/Player",time=1)
response = await getattr(client, "A2F/A2E/SetEmotionByName")(a2f_instance="/World/audio2face/CoreFullface",emotions={"Amazement": 0.3,"Fear": 0.4})
response = await getattr(client, "A2F/A2E/SetEmotion")(a2f_instance="/World/audio2face/CoreFullface",emotion=[0.5,0,0,0.1,0,0,0,0,0,0])
asyncio.ensure_future(self.test_fn_async())
Let me know if you have any doubt !
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.