File size: 1,217 Bytes
8747a63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from audio_recorder_streamlit import audio_recorder
import time

def show_live_session():
    st.title("Live Session Recording")
    
    # Session setup
    if "recording" not in st.session_state:
        st.session_state.recording = False
    
    # Recording controls
    col1, col2 = st.columns(2)
    
    with col1:
        if st.button("Start Recording"):
            st.session_state.recording = True
            
    with col2:
        if st.button("Stop Recording"):
            st.session_state.recording = False
    
    # Recording interface
    if st.session_state.recording:
        audio_bytes = audio_recorder()
        if audio_bytes:
            st.audio(audio_bytes, format="audio/wav")
            
            # Save recording
            timestamp = time.strftime("%Y%m%d-%H%M%S")
            filename = f"session_{timestamp}.wav"
            with open(filename, "wb") as f:
                f.write(audio_bytes)
            
            # Process recording
            analyze_session(audio_bytes)

def analyze_session(audio_bytes):
    # Add your session analysis logic here
    st.write("Processing session...")
    # Implement real-time analysis using your MI prompts