Spaces:
Runtime error
Runtime error
phamngoctukts
commited on
Update app.py
Browse files
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 |
-
|
68 |
-
|
|
|
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
|