How can I make this code work? I’m a newbie using streamlit for just couple of months and want a speech input or audiorecorder for my web-app, how can I make this code work?
import streamlit as st
from streamlit_audiorecorder import audiorecorder
def transcribe_audio_file(audio_data):
# Placeholder for transcription logic.
# This should be replaced with your actual transcription code.
transcript = "This is a placeholder transcript."
return transcript
def main():
st.title("Audio Recorder App")
mode = st.selectbox("Select Mode", ["Record Audio", "Share Screen with DocuNexus", "Talk to DocuNexus"])
if mode == "Record Audio":
audio_data = audiorecorder("Record your question", "Click to record")
if audio_data:
st.audio(audio_data, format='audio/wav')
transcript = transcribe_audio_file(audio_data)
st.write("Transcript:")
st.write(transcript)
elif mode == "Talk to DocuNexus":
st.write("Talk to DocuNexus mode selected.")
# Add your additional logic for Talk to DocuNexus here
if __name__ == "__main__":
main()
it keep saying
ModuleNotFoundError: No module named 'streamlit_audiorecorder'
Traceback:
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 579, in code_to_exec
exec(code, module.__dict__)
File "C:\Users\Downloads\screensharing\audiorecord.py", line 2, in <module>
from streamlit_audiorecorder import audiorecorder
even though I have it
$ pip list | grep streamlit-audiorecorder
streamlit-audiorecorder 0.0.6