Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,7 +65,11 @@ def determine_pause(audio:np.ndarray,sampling_rate:int,state:AppState) -> bool:
|
|
| 65 |
def process_audio(audio:tuple,state:AppState,image:Image):
|
| 66 |
if state.recording: # Kiểm tra state.stream:
|
| 67 |
if state.stream is not None:
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
else:
|
| 70 |
state.stream = audio[1]
|
| 71 |
state.sampling_rate = audio[0]
|
|
|
|
| 65 |
def process_audio(audio:tuple,state:AppState,image:Image):
|
| 66 |
if state.recording: # Kiểm tra state.stream:
|
| 67 |
if state.stream is not None:
|
| 68 |
+
try:
|
| 69 |
+
state.stream = np.concatenate((state.stream, audio[1]))
|
| 70 |
+
except Exception as e:
|
| 71 |
+
print(f"Lỗi tổng hợp giọng nói: {e}")
|
| 72 |
+
return state, None
|
| 73 |
else:
|
| 74 |
state.stream = audio[1]
|
| 75 |
state.sampling_rate = audio[0]
|