Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,17 @@ from pydub import AudioSegment
|
|
16 |
from dataclasses import dataclass
|
17 |
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
def determine_pause(audio: np.ndarray, sampling_rate: int, state: AppState) -> bool:
|
21 |
"""Take in the stream, determine if a pause happened"""
|
@@ -34,14 +45,6 @@ def determine_pause(audio: np.ndarray, sampling_rate: int, state: AppState) -> b
|
|
34 |
|
35 |
return (duration - dur_vad) > 1
|
36 |
|
37 |
-
# Define AppState dataclass for managing the application's state
|
38 |
-
@dataclass
|
39 |
-
class AppState:
|
40 |
-
stream: np.ndarray | None = None
|
41 |
-
sampling_rate: int = 0
|
42 |
-
pause_detected: bool = False
|
43 |
-
stopped: bool = False
|
44 |
-
conversation: list = []
|
45 |
|
46 |
# Neo4j setup
|
47 |
graph = Neo4jGraph(
|
|
|
16 |
from dataclasses import dataclass
|
17 |
|
18 |
|
19 |
+
# Define AppState dataclass for managing the application's state
|
20 |
+
@dataclass
|
21 |
+
class AppState:
|
22 |
+
stream: np.ndarray | None = None
|
23 |
+
sampling_rate: int = 0
|
24 |
+
pause_detected: bool = False
|
25 |
+
stopped: bool = False
|
26 |
+
conversation: list = []
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
|
31 |
def determine_pause(audio: np.ndarray, sampling_rate: int, state: AppState) -> bool:
|
32 |
"""Take in the stream, determine if a pause happened"""
|
|
|
45 |
|
46 |
return (duration - dur_vad) > 1
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
# Neo4j setup
|
50 |
graph = Neo4jGraph(
|