File size: 1,691 Bytes
d296c34
 
e87f4b7
 
d296c34
 
 
 
 
 
 
 
e87f4b7
 
d296c34
e87f4b7
 
 
 
 
 
 
 
d296c34
 
e87f4b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d296c34
 
 
 
 
 
 
 
e87f4b7
 
 
 
 
d296c34
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
import streamlit as st
from st_audiorec import st_audiorec
from Modules.Speech2Text.transcribe import transcribe
import base64

st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
# Create two columns
col1, col2 = st.columns(2)

# First column containers
with col1:
    st.subheader("Audio Recorder")
    recorded = False
    temp_path = 'data/temp_audio/audio_file.wav'
    wav_audio_data = st_audiorec()
    if wav_audio_data is not None:
        with open(temp_path, 'wb') as f:
            # Write the audio data to the file
            f.write(wav_audio_data)
        instruction = transcribe(temp_path)
        print(instruction)
        recorded = True


    st.subheader("LLM answering")
    if recorded:
        if "messages" not in st.session_state:
            st.session_state.messages = []
        for message in st.session_state.messages:
            with st.chat_message(message["role"]):
                st.markdown(message["content"])

        st.session_state.messages.append({"role": "user", "content": instruction})
        with st.chat_message("user"):
            st.markdown(instruction)

        with st.chat_message("assistant"):
            # Build answer from LLM
            response = " to be DEFINED - TO DO"
        st.session_state.messages.append({"role": "assistant", "content": response})

    st.subheader("Movement Analysis")

# Second column containers
with col2:
    st.subheader("Sports Agenda")

    st.subheader("Video Analysis")
    _left, mid, _right = st.columns(3)
    with mid:
        video_path = "./data/pose/squat_inference.mp4"
        # Display the video
        st.video(video_path)

    st.subheader("Graph Displayer")