-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux Support #7
Comments
There are only 2 part's in the code that are platform specific. The MacOS guide is probably pretty close to how it is on Linux. If you want to make it Linux compatible, you can make the following changes to the code: Change this:if platform.system() == 'Windows':
MODEL_PATH = "Miles/miles-50k.onnx"
INFERENCE_FRAMEWORK = 'onnx'
DETECTION_THRESHOLD = 0.01
elif platform.system() == 'Darwin': # macOS
print("User is on macOS, using tflite model.")
MODEL_PATH = "Miles/miles-50k.tflite"
INFERENCE_FRAMEWORK = 'tflite'
DETECTION_THRESHOLD = 0.01
else:
raise Exception("Unsupported operating system for this application.")
BEEP_SOUND_PATH = "beep_sound.wav"
def play_beep():
if platform.system() == 'Darwin': # macOS
subprocess.run(["afplay", BEEP_SOUND_PATH])
elif platform.system() == 'Windows':
import winsound # Import winsound only on Windows
winsound.PlaySound(BEEP_SOUND_PATH, winsound.SND_FILENAME)
else:
print("Unsupported operating system for beep sound.") To this:if platform.system() == 'Windows':
MODEL_PATH = "Miles/miles-50k.onnx"
INFERENCE_FRAMEWORK = 'onnx'
DETECTION_THRESHOLD = 0.01
elif platform.system() == 'Darwin': # macOS
print("User is on macOS, using tflite model.")
MODEL_PATH = "Miles/miles-50k.tflite"
INFERENCE_FRAMEWORK = 'tflite'
DETECTION_THRESHOLD = 0.01
elif platform.system() == 'Linux':
# Check for TensorFlow Lite availability, fall back to ONNX if necessary
try:
import tflite_runtime.interpreter as tflite
print("Using TensorFlow Lite model on Linux.")
MODEL_PATH = "Miles/miles-50k.tflite"
INFERENCE_FRAMEWORK = 'tflite'
except ImportError:
print("tflite_runtime is not available, using ONNX model.")
MODEL_PATH = "Miles/miles-50k.onnx"
INFERENCE_FRAMEWORK = 'onnx'
DETECTION_THRESHOLD = 0.01
else:
raise Exception("Unsupported operating system for this application. Tried Linux, Windows, and macOS. All Failed.")
BEEP_SOUND_PATH = "beep_sound.wav"
def play_beep():
if platform.system() == 'Darwin': # macOS
subprocess.run(["afplay", BEEP_SOUND_PATH])
elif platform.system() == 'Windows':
import winsound # Import winsound only on Windows
winsound.PlaySound(BEEP_SOUND_PATH, winsound.SND_FILENAME)
elif platform.system() == 'Linux':
# Use aplay for Linux audio playback
subprocess.run(["aplay", BEEP_SOUND_PATH])
else:
print("Unsupported operating system for beep sound, tried Linux, Windows, and macOS. All Failed.") |
Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please consider adding support for Linux to M.I.L.E.S. 🔨
The text was updated successfully, but these errors were encountered: