Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastrtc import Stream, ReplyOnPause
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
|
5 |
+
def detection(audio: tuple[int, np.ndarray]):
|
6 |
+
# Implement any iterator that yields audio
|
7 |
+
# See "LLM Voice Chat" for a more complete example
|
8 |
+
yield audio
|
9 |
+
|
10 |
+
|
11 |
+
stream = Stream(
|
12 |
+
handler=ReplyOnPause(detection),
|
13 |
+
modality="audio",
|
14 |
+
mode="send-receive",
|
15 |
+
)
|
16 |
+
|
17 |
+
|
18 |
+
if __name__ == "__main__":
|
19 |
+
import uvicorn
|
20 |
+
|
21 |
+
uvicorn.run(stream, host="0.0.0.0", port=7860)
|