ai-lover commited on
Commit
8fa5735
·
verified ·
1 Parent(s): 0499f60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
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
- os.environ["SDL_AUDIODRIVER"] = "dummy" # Use the dummy audio driver
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.")