Spaces:
Build error
Build error
http
Browse files- client/pdm.lock +66 -1
- client/pyproject.toml +1 -0
- client/src/main.py +8 -1
- server/src/main.py +3 -3
client/pdm.lock
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
groups = ["default"]
|
6 |
strategy = ["cross_platform"]
|
7 |
lock_version = "4.4"
|
8 |
-
content_hash = "sha256:
|
9 |
|
10 |
[[package]]
|
11 |
name = "accelerate"
|
@@ -26,6 +26,20 @@ files = [
|
|
26 |
{file = "accelerate-0.26.1.tar.gz", hash = "sha256:bf63716b6bd9460d87da970cf4d833abb824ca0aa633be36b741e63a1b504f89"},
|
27 |
]
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
[[package]]
|
30 |
name = "certifi"
|
31 |
version = "2023.11.17"
|
@@ -106,6 +120,47 @@ files = [
|
|
106 |
{file = "fsspec-2023.12.2.tar.gz", hash = "sha256:8548d39e8810b59c38014934f6b31e57f40c1b20f911f4cc2b85389c7e9bf0cb"},
|
107 |
]
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
[[package]]
|
110 |
name = "huggingface-hub"
|
111 |
version = "0.20.2"
|
@@ -526,6 +581,16 @@ files = [
|
|
526 |
{file = "safetensors-0.4.1.tar.gz", hash = "sha256:2304658e6ada81a5223225b4efe84748e760c46079bffedf7e321763cafb36c9"},
|
527 |
]
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
[[package]]
|
530 |
name = "speechrecognition"
|
531 |
version = "3.10.1"
|
|
|
5 |
groups = ["default"]
|
6 |
strategy = ["cross_platform"]
|
7 |
lock_version = "4.4"
|
8 |
+
content_hash = "sha256:cb77a02fed8fa68d3cdbb9acec8b4eb8cd20809e92c3fb5f5195bcb1e80fedb7"
|
9 |
|
10 |
[[package]]
|
11 |
name = "accelerate"
|
|
|
26 |
{file = "accelerate-0.26.1.tar.gz", hash = "sha256:bf63716b6bd9460d87da970cf4d833abb824ca0aa633be36b741e63a1b504f89"},
|
27 |
]
|
28 |
|
29 |
+
[[package]]
|
30 |
+
name = "anyio"
|
31 |
+
version = "4.2.0"
|
32 |
+
requires_python = ">=3.8"
|
33 |
+
summary = "High level compatibility layer for multiple asynchronous event loop implementations"
|
34 |
+
dependencies = [
|
35 |
+
"idna>=2.8",
|
36 |
+
"sniffio>=1.1",
|
37 |
+
]
|
38 |
+
files = [
|
39 |
+
{file = "anyio-4.2.0-py3-none-any.whl", hash = "sha256:745843b39e829e108e518c489b31dc757de7d2131d53fac32bd8df268227bfee"},
|
40 |
+
{file = "anyio-4.2.0.tar.gz", hash = "sha256:e1875bb4b4e2de1669f4bc7869b6d3f54231cdced71605e6e64c9be77e3be50f"},
|
41 |
+
]
|
42 |
+
|
43 |
[[package]]
|
44 |
name = "certifi"
|
45 |
version = "2023.11.17"
|
|
|
120 |
{file = "fsspec-2023.12.2.tar.gz", hash = "sha256:8548d39e8810b59c38014934f6b31e57f40c1b20f911f4cc2b85389c7e9bf0cb"},
|
121 |
]
|
122 |
|
123 |
+
[[package]]
|
124 |
+
name = "h11"
|
125 |
+
version = "0.14.0"
|
126 |
+
requires_python = ">=3.7"
|
127 |
+
summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
|
128 |
+
files = [
|
129 |
+
{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
|
130 |
+
{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
|
131 |
+
]
|
132 |
+
|
133 |
+
[[package]]
|
134 |
+
name = "httpcore"
|
135 |
+
version = "1.0.2"
|
136 |
+
requires_python = ">=3.8"
|
137 |
+
summary = "A minimal low-level HTTP client."
|
138 |
+
dependencies = [
|
139 |
+
"certifi",
|
140 |
+
"h11<0.15,>=0.13",
|
141 |
+
]
|
142 |
+
files = [
|
143 |
+
{file = "httpcore-1.0.2-py3-none-any.whl", hash = "sha256:096cc05bca73b8e459a1fc3dcf585148f63e534eae4339559c9b8a8d6399acc7"},
|
144 |
+
{file = "httpcore-1.0.2.tar.gz", hash = "sha256:9fc092e4799b26174648e54b74ed5f683132a464e95643b226e00c2ed2fa6535"},
|
145 |
+
]
|
146 |
+
|
147 |
+
[[package]]
|
148 |
+
name = "httpx"
|
149 |
+
version = "0.26.0"
|
150 |
+
requires_python = ">=3.8"
|
151 |
+
summary = "The next generation HTTP client."
|
152 |
+
dependencies = [
|
153 |
+
"anyio",
|
154 |
+
"certifi",
|
155 |
+
"httpcore==1.*",
|
156 |
+
"idna",
|
157 |
+
"sniffio",
|
158 |
+
]
|
159 |
+
files = [
|
160 |
+
{file = "httpx-0.26.0-py3-none-any.whl", hash = "sha256:8915f5a3627c4d47b73e8202457cb28f1266982d1159bd5779d86a80c0eab1cd"},
|
161 |
+
{file = "httpx-0.26.0.tar.gz", hash = "sha256:451b55c30d5185ea6b23c2c793abf9bb237d2a7dfb901ced6ff69ad37ec1dfaf"},
|
162 |
+
]
|
163 |
+
|
164 |
[[package]]
|
165 |
name = "huggingface-hub"
|
166 |
version = "0.20.2"
|
|
|
581 |
{file = "safetensors-0.4.1.tar.gz", hash = "sha256:2304658e6ada81a5223225b4efe84748e760c46079bffedf7e321763cafb36c9"},
|
582 |
]
|
583 |
|
584 |
+
[[package]]
|
585 |
+
name = "sniffio"
|
586 |
+
version = "1.3.0"
|
587 |
+
requires_python = ">=3.7"
|
588 |
+
summary = "Sniff out which async library your code is running under"
|
589 |
+
files = [
|
590 |
+
{file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"},
|
591 |
+
{file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"},
|
592 |
+
]
|
593 |
+
|
594 |
[[package]]
|
595 |
name = "speechrecognition"
|
596 |
version = "3.10.1"
|
client/pyproject.toml
CHANGED
@@ -10,6 +10,7 @@ dependencies = [
|
|
10 |
"PyAudio>=0.2.14",
|
11 |
"SpeechRecognition>=3.10.1",
|
12 |
"transformers[torch]>=4.36.2",
|
|
|
13 |
]
|
14 |
requires-python = ">=3.11"
|
15 |
readme = "README.md"
|
|
|
10 |
"PyAudio>=0.2.14",
|
11 |
"SpeechRecognition>=3.10.1",
|
12 |
"transformers[torch]>=4.36.2",
|
13 |
+
"httpx>=0.26.0",
|
14 |
]
|
15 |
requires-python = ">=3.11"
|
16 |
readme = "README.md"
|
client/src/main.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from queue import Queue
|
2 |
import logging
|
3 |
from datetime import UTC, datetime, timedelta
|
@@ -10,6 +11,9 @@ from audio_utils import get_microphone, get_speech_recognizer, get_all_audio_que
|
|
10 |
|
11 |
logger = logging.getLogger(__name__)
|
12 |
|
|
|
|
|
|
|
13 |
def main():
|
14 |
recording_duration = 2
|
15 |
sample_rate = 16000
|
@@ -48,7 +52,10 @@ def main():
|
|
48 |
|
49 |
if current_audio_chunk.is_complete:
|
50 |
serialized = pickle.dumps(current_audio_chunk.audio_array)
|
51 |
-
|
|
|
|
|
|
|
52 |
# text = transcribe_model.transcribe(current_audio_chunk.audio_array)
|
53 |
# sentence = Sentence(
|
54 |
# start_time=current_audio_chunk.start_time, end_time=current_audio_chunk.end_time, text=text
|
|
|
1 |
+
import httpx
|
2 |
from queue import Queue
|
3 |
import logging
|
4 |
from datetime import UTC, datetime, timedelta
|
|
|
11 |
|
12 |
logger = logging.getLogger(__name__)
|
13 |
|
14 |
+
TRANSCRIBING_SERVER = "http://localhost:3535/transcribe"
|
15 |
+
|
16 |
+
|
17 |
def main():
|
18 |
recording_duration = 2
|
19 |
sample_rate = 16000
|
|
|
52 |
|
53 |
if current_audio_chunk.is_complete:
|
54 |
serialized = pickle.dumps(current_audio_chunk.audio_array)
|
55 |
+
|
56 |
+
response = httpx.post(TRANSCRIBING_SERVER, data=serialized)
|
57 |
+
print('chunk done', response.text, response.status_code)
|
58 |
+
|
59 |
# text = transcribe_model.transcribe(current_audio_chunk.audio_array)
|
60 |
# sentence = Sentence(
|
61 |
# start_time=current_audio_chunk.start_time, end_time=current_audio_chunk.end_time, text=text
|
server/src/main.py
CHANGED
@@ -10,6 +10,6 @@ def read_root():
|
|
10 |
return {"status": "ok"}
|
11 |
|
12 |
|
13 |
-
@app.
|
14 |
-
def
|
15 |
-
return {"
|
|
|
10 |
return {"status": "ok"}
|
11 |
|
12 |
|
13 |
+
@app.post("/transcribe")
|
14 |
+
def transcribe(audio: bytes):
|
15 |
+
return {"transcribe": "hello"}
|