KHome / demo.py
hanxu22
add rerank test
1f16925
import streamlit as st
import base64
from streamlit.components.v1 import html
st.title("Video Player App")
video_file_path = "D:\\huggingface\\KHome\\digitalhuman.mp4"
# 读取视频文件的内容
with open(video_file_path, "rb") as video_file:
video_bytes = video_file.read()
video_base64 = base64.b64encode(video_bytes).decode('utf-8')
STOPPED_STATE = f"""
<video id="videoPlayer" width="320" height="240" controls>
<source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
Your browser does not support the video tag.
</video>
"""
PLAYING_STATE = f"""
<video id="videoPlayer" width="320" height="240" controls autoplay>
<source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
Your browser does not support the video tag.
</video>
"""
playstate = st.session_state.get("playstate")
if not playstate:
playstate = STOPPED_STATE
st.markdown(playstate, unsafe_allow_html=True)
# 播放按钮
if st.button("Play"):
st.session_state["playstate"] = PLAYING_STATE
# 暂停按钮
if st.button("Pause"):
st.session_state["playstate"] = STOPPED_STATE