Spaces:
Build error
Build error
Commit
·
cabf3df
1
Parent(s):
2b30df7
Update app.py
Browse files
app.py
CHANGED
@@ -6,17 +6,17 @@ st.markdown("<h1 style='text-align: center;'>Tell us how you feel</h1>", unsafe_
|
|
6 |
|
7 |
st.write("<h3 style='text-align: center; color: lightSeaGreen;'>we'll generate the insights</h3>", unsafe_allow_html=True)
|
8 |
|
9 |
-
|
|
|
10 |
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
st.text_area(label="Output",
|
21 |
-
value=f"Frame rate: {audio.frame_rate}, Frame width: {audio.frame_width}, Duration: {audio.duration_seconds} seconds",
|
22 |
-
height=300)
|
|
|
6 |
|
7 |
st.write("<h3 style='text-align: center; color: lightSeaGreen;'>we'll generate the insights</h3>", unsafe_allow_html=True)
|
8 |
|
9 |
+
# Create a speech_recorder component.
|
10 |
+
speech_recorder = hf.spaces.component("speech_recorder", language="en", sampling_rate=16000)
|
11 |
|
12 |
+
# Add a button to the app that allows users to start and stop recording.
|
13 |
+
button = st.button("Record speech")
|
14 |
|
15 |
+
# When the user clicks the button, start recording the user's speech.
|
16 |
+
if button.clicked:
|
17 |
+
speech_recorder.start()
|
18 |
|
19 |
+
# When the user stops recording, return a transcript of the user's speech.
|
20 |
+
if speech_recorder.is_finished:
|
21 |
+
transcript = speech_recorder.get_transcript()
|
22 |
+
st.write(transcript)
|
|
|
|
|
|