File size: 859 Bytes
9191a09
46c1055
 
9191a09
 
 
 
 
 
cabf3df
 
9191a09
cabf3df
 
9191a09
cabf3df
 
 
9191a09
cabf3df
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
#from audiorecorder import audiorecorder
import huggingface_hub as hf


st.markdown("<h1 style='text-align: center;'>Tell us how you feel</h1>", unsafe_allow_html=True)

st.write("<h3 style='text-align: center; color: lightSeaGreen;'>we'll generate the insights</h3>", unsafe_allow_html=True)

# Create a speech_recorder component.
speech_recorder = hf.spaces.component("speech_recorder", language="en", sampling_rate=16000)

# Add a button to the app that allows users to start and stop recording.
button = st.button("Record speech")

# When the user clicks the button, start recording the user's speech.
if button.clicked:
    speech_recorder.start()

# When the user stops recording, return a transcript of the user's speech.
if speech_recorder.is_finished:
    transcript = speech_recorder.get_transcript()
    st.write(transcript)