phamngoctukts commited on
Commit
702b99d
·
verified ·
1 Parent(s): 402b53e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -64,12 +64,11 @@ def determine_pause(audio:np.ndarray,sampling_rate:int,state:AppState) -> bool:
64
 
65
  def process_audio(audio:tuple,state:AppState,image:Image):
66
  if state.recording: # Kiểm tra state.stream:
67
- time.sleep(0.1)
68
- if state.stream is None:
 
69
  state.stream = audio[1]
70
  state.sampling_rate = audio[0]
71
- else:
72
- state.stream = np.concatenate((state.stream, audio[1]))
73
  state.image_in=image
74
  pause_detected = determine_pause(state.stream, state.sampling_rate, state)
75
  state.pause_detected = pause_detected
 
64
 
65
  def process_audio(audio:tuple,state:AppState,image:Image):
66
  if state.recording: # Kiểm tra state.stream:
67
+ if state.stream:
68
+ state.stream = np.concatenate((state.stream, audio[1]))
69
+ else:
70
  state.stream = audio[1]
71
  state.sampling_rate = audio[0]
 
 
72
  state.image_in=image
73
  pause_detected = determine_pause(state.stream, state.sampling_rate, state)
74
  state.pause_detected = pause_detected