Comments (2)
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.")
from m.i.l.e.s.
Thanks
from m.i.l.e.s.
Related Issues (8)
- Gemini pro 1.5 support? HOT 12
- Setup does not save to apikey.py HOT 3
- Tfile runtime only supported on Linux and not MacOS HOT 3
- Config Phyton Error HOT 8
- Windows - Perpetually Listening for prompt HOT 3
- Getting an error right after completing setup. HOT 8
- Error Loading melspectrogram.onnx with ONNX Runtime in M.I.L.E.S Project HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m.i.l.e.s.