No such file error while deploying application on streamlit

Hi i am getting this error while trying to deploy my app in streamlit cloud. here is the github repo of my application.
audiotranscription/app.py at main · Sudipta013/audiotranscription (github.com)
can yout kindly check what is the issue in the application. Thanks in advance.

Hey @sudipta_paul,

Can you share the full text of the error message (rather than a screenshot of the app)?

Hi @Caroline here is the error which i recieved on log:

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/whisper/audio.py", line 42, in load_audio

    ffmpeg.input(file, threads=0)

  File "/home/adminuser/venv/lib/python3.9/site-packages/ffmpeg/_run.py", line 325, in run

    raise Error('ffmpeg', out, err)

ffmpeg._run.Error: ffmpeg error (see stderr output for detail)


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/audiotranscription/app.py", line 19, in <module>

    transcription = model.transcribe(audio_file.name, fp16=False, language='English')

  File "/home/adminuser/venv/lib/python3.9/site-packages/whisper/transcribe.py", line 76, in transcribe

    mel = log_mel_spectrogram(audio)

  File "/home/adminuser/venv/lib/python3.9/site-packages/whisper/audio.py", line 111, in log_mel_spectrogram

    audio = load_audio(audio)

  File "/home/adminuser/venv/lib/python3.9/site-packages/whisper/audio.py", line 47, in load_audio

    raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e

RuntimeError: Failed to load audio: ffmpeg version 4.3.6-0+deb11u1 Copyright (c) 2000-2023 the FFmpeg developers

  built with gcc 10 (Debian 10.2.1-6)

  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared

  libavutil      56. 51.100 / 56. 51.100

  libavcodec     58. 91.100 / 58. 91.100

  libavformat    58. 45.100 / 58. 45.100

  libavdevice    58. 10.100 / 58. 10.100

  libavfilter     7. 85.100 /  7. 85.100

  libavresample   4.  0.  0 /  4.  0.  0

  libswscale      5.  7.100 /  5.  7.100

  libswresample   3.  7.100 /  3.  7.100

  libpostproc    55.  7.100 / 55.  7.100

sample-1.mp3: No such file or directory

Does the app throw the same error when you run it locally?

This should be the reason…

Yeah, it sounds like that file is being uploaded via the st.file_uploader and that error is being thrown because that widget doesn’t return an actual file; it returns a file-like BytesIO object

then is there any way by which i can access the file which i have uploaded using file_uploader?
i need to have the file to pass it in th transcribe() function.

You can save it as a temporary file.

yes i tried that way and it worked actually as @Caroline mentioned the st.fileUploader return byteIO object so i think that file return type in bytes so i first saved the file in temporary location and used the path of the temfile as an arg. for transcribe function.
i found this topic recently…
File uploading and reading using st.file_uploader - :balloon: Using Streamlit - Streamlit

THNK YOU for the help @Franky1 @Caroline.