cherrvak's picture
initial commit
2c04fa5
import os
import streamlit.components.v1 as components
_RELEASE = True
if not _RELEASE:
_component_func = components.declare_component(
"model_demo",
url="http://localhost:3001",
)
else:
# When we're distributing a production version of the component, we'll
# replace the `url` param with `path`, and point it to the component's
# build directory:
parent_dir = os.path.dirname(os.path.abspath(__file__))
build_dir = os.path.join(parent_dir, "frontend/build")
_component_func = components.declare_component("model_demo", path=build_dir)
def model_demo(
blendshapes=None, headangles=None, audio_data=None, vrm_data=None, key=None
):
component_value = _component_func(
blendshapes=blendshapes.tolist() if blendshapes is not None else None,
headangles=headangles.tolist() if headangles is not None else None,
audio_data=audio_data.decode("latin1") if audio_data is not None else None,
vrm_data=[int(b) for b in vrm_data] if vrm_data is not None else None,
key=key,
default=0,
)
return component_value