File size: 1,530 Bytes
c244e32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import streamlit as st
import os
import subprocess

st.title("TalkSHOW Demo")
st.write(
    "Upload an audio file and generate motion using the TalkSHOW model."
)

# File uploader for audio
audio_file = st.file_uploader("Upload an audio file (.wav)", type=["wav"])

# Temporary path for uploaded file
UPLOAD_DIR = "uploaded_audios"
os.makedirs(UPLOAD_DIR, exist_ok=True)

if audio_file is not None:
    file_path = os.path.join(UPLOAD_DIR, audio_file.name)
    with open(file_path, "wb") as f:
        f.write(audio_file.getbuffer())
    st.success(f"Uploaded {audio_file.name}")

    # Run demo.py (adjust path/args as needed)
    if st.button("Run TalkSHOW Demo"):
        with st.spinner("Generating motion..."):
            # Modify this command as needed to fit demo.py usage!
            command = [
                "python",
                "scripts/demo.py",
                "--audio", file_path
                # add other arguments if required, e.g., model paths, output dirs, etc.
            ]
            result = subprocess.run(command, capture_output=True, text=True)
            st.text(result.stdout)
            st.text(result.stderr)

        st.success("Demo complete!")
        # If demo.py outputs images or videos, display them here
        # st.image("output.png") or st.video("output.mp4") as needed

# Add instructions or info
st.info("This is a basic demo app. You may need to adjust arguments to demo.py based on your setup and what output you want to show.")