It seems that the issue may be related to the file paths used by the Azure speech SDK. Since the SDK is unable to find the required files when running from the .app file, but can find them when running from the Unix executable, it is possible that the file paths are not being set correctly.
One potential solution would be to explicitly set the file paths used by the SDK in your Python code. You can try using the os
module to get the current working directory, and then append the required file paths to this directory. For example:
makefileCopy code
import os
from azure.cognitiveservices.speech import SpeechConfig
# Get the current working directory
cwd = os.getcwd()
# Set the file paths for the speech SDK
speech_sdk_path = os.path.join(cwd, "path/to/speech/sdk")
dylib_path = os.path.join(cwd, "path/to/dylib/libMicrosoft.CognitiveServices.Speech.core.dylib")
# Set the speech config with the file paths
speech_config = SpeechConfig(subscription="YOUR_SUBSCRIPTION_KEY", region="YOUR_REGION", speech_recognition_language="en-US")
speech_config.set_property_by_name("speechsdk.imports.path", speech_sdk_path)
speech_config.set_property_by_name("speechsdk.imports.dylib_path", dylib_path)
Replace the "path/to/speech/sdk"
and "path/to/dylib/libMicrosoft.CognitiveServices.Speech.core.dylib"
with the actual file paths used by the SDK in your code.
Another potential solution would be to modify the .spec file to explicitly include the required files and directories used by the SDK. You can try adding the following lines to your .spec file:
cssCopy code
binaries = [('path/to/dylib/libMicrosoft.CognitiveServices.Speech.core.dylib', '.')]
datas = [('path/to/speech/sdk/*', 'path/to/speech/sdk/')]
Again, replace "path/to/speech/sdk"
and "path/to/dylib/libMicrosoft.CognitiveServices.Speech.core.dylib"
with the actual file paths used by the SDK in your code.