Spaces:
Sleeping
Sleeping

feat: add complete pipeline and Streamlit code This commit introduces a complete pipeline for both single and real-time inferences using cameras. It includes the implementation of Streamlit code to facilitate the process.
c640bc9
verified
""" | |
Created By: ishwor subedi | |
Date: 2023-12-30 | |
""" | |
import pygame | |
class AlertService: | |
def __init__(self, alert_sound_path): | |
self.alert_sound_path = alert_sound_path | |
pygame.init() | |
def play_alert(self): | |
""" | |
This function help us to play the alert sound | |
:return: | |
""" | |
try: | |
pygame.mixer.init() | |
alert_sound = pygame.mixer.Sound(self.alert_sound_path) | |
alert_sound.play() | |
pygame.time.wait(int(alert_sound.get_length() * 1000)) # Wait for the sound to finish playing | |
except pygame.error as e: | |
print(f"Error playing alert sound: {e}") | |
if __name__ == '__main__': | |
alert_service = AlertService("resources/alert/alert.mp3") | |
alert_service.play_alert() | |