Open HAIXteam opened 1 year ago
Amazing work @PartTimeAI - this is so fun to play with.
I also seem to be having an issue on PC with ffprobe. I have installed it and added it to path.
C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning) Traceback (most recent call last): File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\processing_utils.py", line 200, in audio_from_file audio = AudioSegment.from_file(filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\audio_segment.py", line 728, in from_file info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\utils.py", line 274, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\routes.py", line 384, in run_predict
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\blocks.py", line 1030, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\blocks.py", line 922, in preprocess_data
processed_input.append(block.preprocess(inputs[i]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\components.py", line 2087, in preprocess
sample_rate, data = processing_utils.audio_from_file(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\VideoServer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\processing_utils.py", line 210, in audio_from_file
raise RuntimeError(msg) from e
RuntimeError: Cannot load audio from file: ffprobe
not found. Please install ffmpeg
in your system to use non-WAV audio file formats and make sure ffprobe
is in your PATH.
intall conda and try this. The workaround for M1 macbook conda create -n test2 python=3.10 pip -y pip install gradio
@HAIXteam @deweyai I had the same issue. You have to install ffmpeg from https://ffmpeg.org/download.html. Then add ffprobe.exe to PATH in your environment variables. If you are on Windows you may still have another issue with
subprocess.call(["say", system_message['content']])
The above is for OS. For Windows, you need to do
!pip install pyttsx3
Then use the following three lines to replace subprocess.call(["say", system_message['content']])
engine = pyttsx3.init() engine.say(system_message) engine.runAndWait()
I hope it helps. Enjoy the play!
i had the same issue on windows, i installed ffmpeg and added the bin folder to the PATH, still faced the issue, finally , moved the content of bin folder ( ffmpeg, ffprobe and ffplay executables) to the same folder as my python code and it worked somehow.
hope this helps
i had the same issue on windows, i installed ffmpeg and added the bin folder to the PATH, still faced the issue, finally , moved the content of bin folder ( ffmpeg, ffprobe and ffplay executables) to the same folder as my python code and it worked somehow.
hope this helps
Hi @eliasrob, can you help me out with the steps to do what you did? can't figure out where is the bin folder of ffmpeg?? I'm also using Windows (11)
@mendioroz87
download ffmpeg from here: https://github.com/BtbN/FFmpeg-Builds/releases:
specifically: ffmpeg-master-latest-win64-gpl-shared.zip
then extract the downloaded file and search for the bin folder, and you should find the bin in this path: ffmpeg-master-latest-win64-gpl\ffmpeg-master-latest-win64-gpl\bin
take the 3 executable files from bin and place them on your python project and hopefully that will solve your issue.
@eliasrob thanks! It did make a difference indeed, although I had to include the variables in the PATH, after that it was at least counting the seconds
but it errored out with:
C:\Python310\Lib\site-packages\gradio\processing_utils.py:242: UserWarning: Trying to convert audio automatically from int32 to 16-bit int format. warnings.warn(warning.format(data.dtype)) Traceback (most recent call last): File "C:\Python310\Lib\site-packages\gradio\routes.py", line 384, in run_predict output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python310\Lib\site-packages\gradio\blocks.py", line 1032, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python310\Lib\site-packages\gradio\blocks.py", line 844, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python310\Lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python310\Lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "C:\Python310\Lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\Jose Mendioroz\OneDrive\Documents\Visual Studio 2017\OpenAI\therapist.py", line 20, in transcribe subprocess.call(["say", system_message['content']]) File "C:\Python310\Lib\subprocess.py", line 389, in call with Popen(*popenargs, **kwargs) as p: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python310\Lib\subprocess.py", line 1024, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python310\Lib\subprocess.py", line 1493, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified
In the Youtube video, I found a comment from @christophermorris486 and after replacing the suggested line:
subprocess.call(["say", system_message['content']])
with:
word = system_message['content']
talk = f'(New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak("{word}");'
subprocess.call(['PowerShell', 'Add-Type -AssemblyName System.Speech;', talk], shell=True)
@PartTimeAI / @hackingthemarkets It worked on Windows, now, let's figure it out how to use another voice synthesizer??
@mendioroz87 apparently you can access additional Microsoft text to speech voices (available through the UI and not available via Powershell) you have installed on Windows 10 and 11 though it requires hacking the registry:
https://www.reddit.com/r/PowerShell/comments/bdk6ve/listing_and_selecting_texttospeech_voices/
https://www.reddit.com/r/Windows10/comments/96dx8z/how_unlock_all_windows_10_hidden_tts_voices_for/ https://gist.github.com/hiepxanh/8b6ad80f6d620cd3eaaaa5c1d2c660b2
Solved solution go to this repo https://github.com/VikasSharma707/chatgpt-api-whisper-api-voice-assistant
Solved solution go to this repo https://github.com/VikasSharma707/chatgpt-api-whisper-api-voice-assistant
Thanks for your link. I was having a lot of problems trying to make it work on Windows. However, I had to change some lines in order to make it work.
audio_segment = AudioSegment.from_file(audio).export("converted_audio.wav", format="wav") print(audio_segment)
And
ui = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone",type="filepath"), outputs="text")
Good work @PartTimeAI
RuntimeError: Cannot load audio from file:
ffprobe
not found. Please installffmpeg
in your system to use non-WAV audio file formats and make sureffprobe
is in your PATH.I installed ffrobe also. still getting this error. can you look at this fix?
full message below..
Traceback (most recent call last): File "C:\Users\44754\anaconda3\lib\site-packages\gradio\processing_utils.py", line 200, in audio_from_file audio = AudioSegment.from_file(filename) File "C:\Users\44754\anaconda3\lib\site-packages\pydub\audio_segment.py", line 728, in from_file info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit) File "C:\Users\44754\anaconda3\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) File "C:\Users\44754\anaconda3\lib\subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\44754\anaconda3\lib\subprocess.py", line 1311, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\44754\anaconda3\lib\site-packages\gradio\routes.py", line 384, in run_predict output = await app.get_blocks().process_api( File "C:\Users\44754\anaconda3\lib\site-packages\gradio\blocks.py", line 1030, in process_api inputs = self.preprocess_data(fn_index, inputs, state) File "C:\Users\44754\anaconda3\lib\site-packages\gradio\blocks.py", line 922, in preprocess_data processed_input.append(block.preprocess(inputs[i])) File "C:\Users\44754\anaconda3\lib\site-packages\gradio\components.py", line 2087, in preprocess sample_rate, data = processing_utils.audio_from_file( File "C:\Users\44754\anaconda3\lib\site-packages\gradio\processing_utils.py", line 210, in audio_from_file raise RuntimeError(msg) from e RuntimeError: Cannot load audio from file:
ffprobe
not found. Please installffmpeg
in your system to use non-WAV audio file formats and make sureffprobe
is in your PATH.