Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,18 +5,14 @@ import cv2
|
|
5 |
import random
|
6 |
import time
|
7 |
from gtts import gTTS
|
8 |
-
import pygame
|
9 |
import threading
|
10 |
from datetime import datetime, timedelta
|
11 |
|
12 |
# Check if running in a cloud environment (e.g., Hugging Face Spaces)
|
13 |
running_in_cloud = "HF_HOME" in os.environ
|
14 |
|
15 |
-
if running_in_cloud:
|
16 |
-
|
17 |
-
print("Running in a cloud environment: Audio alerts disabled.")
|
18 |
-
else:
|
19 |
-
# Initialize pygame mixer
|
20 |
pygame.mixer.quit() # Ensure the mixer is fully stopped
|
21 |
pygame.mixer.init()
|
22 |
|
@@ -194,4 +190,4 @@ if start_detection:
|
|
194 |
pygame.mixer.quit()
|
195 |
|
196 |
elif stop_detection:
|
197 |
-
st.warning("Object detection stopped.")
|
|
|
5 |
import random
|
6 |
import time
|
7 |
from gtts import gTTS
|
|
|
8 |
import threading
|
9 |
from datetime import datetime, timedelta
|
10 |
|
11 |
# Check if running in a cloud environment (e.g., Hugging Face Spaces)
|
12 |
running_in_cloud = "HF_HOME" in os.environ
|
13 |
|
14 |
+
if not running_in_cloud:
|
15 |
+
import pygame
|
|
|
|
|
|
|
16 |
pygame.mixer.quit() # Ensure the mixer is fully stopped
|
17 |
pygame.mixer.init()
|
18 |
|
|
|
190 |
pygame.mixer.quit()
|
191 |
|
192 |
elif stop_detection:
|
193 |
+
st.warning("Object detection stopped.")
|