Skip to content

Commit

Permalink
change names for streaming and non-streaming server
Browse files Browse the repository at this point in the history
  • Loading branch information
hexins committed Oct 12, 2023
1 parent 9800a77 commit deca696
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 521 deletions.
14 changes: 6 additions & 8 deletions python-api-examples/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@
("/js/bootstrap.min.js", "application/javascript"),
("/js/bootstrap.min.js.map", "application/javascript"),
("/js/jquery-3.6.0.min.js", "application/javascript"),
("/js/offline_record_streaming.js", "application/javascript"),
("/js/offline_record_non_streaming.js", "application/javascript"),
("/js/non_streaming_record.js", "application/javascript"),
("/js/popper.min.js", "application/javascript"),
("/js/popper.min.js.map", "application/javascript"),
("/js/streaming_record.js", "application/javascript"),
("/js/upload_streaming.js", "application/javascript"),
("/js/upload_non_streaming.js", "application/javascript"),
("/js/streaming_upload.js", "application/javascript"),
("/js/non_streaming_upload.js", "application/javascript"),
("/k2-logo.png", "image/png"),
("/nav-partial.html", "text/html"),
("/offline_record_streaming.html", "text/html"),
("/offline_record_non_streaming.html", "text/html"),
("/non_streaming_record.html", "text/html"),
("/streaming_record.html", "text/html"),
("/upload_streaming.html", "text/html"),
("/upload_non_streaming.html", "text/html"),
("/streaming_upload.html", "text/html"),
("/non_streaming_upload.html", "text/html"),
)

_404_page = r"""
Expand Down
4 changes: 2 additions & 2 deletions python-api-examples/non_streaming_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ async def process_request(
if path == "/":
path = "/index.html"
if path == "/upload.html":
path = "/upload_non_streaming.html"
path = "/non_streaming_upload.html"
if path == "/offline_record.html":
path = "/offline_record_non_streaming.html"
path = "/non_streaming_record.html"
if path[-1] == "?":
path = path[:-1]

Expand Down
22 changes: 19 additions & 3 deletions python-api-examples/streaming_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,26 @@ async def process_request(
if path == "/":
path = "/index.html"
if path == "/upload.html":
path = "/upload_streaming.html"
path = "/streaming_upload.html"
if path == "/offline_record.html":
path = "/offline_record_streaming.html"
found, response, mime_type = self.http_server.process_request(path)
response = r"""
<!doctype html><html><head>
<title>Speech recognition with next-gen Kaldi</title><body>
<h2>Only
<a href="/upload.html">/upload.html</a>
and
<a href="/streaming_record.html">/streaming_record.html</a>
is available for the streaming server.<h2>
<br/>
<br/>
Go back to <a href="/upload.html">/upload.html</a>
or <a href="/streaming_record.html">/streaming_record.html</a>
</body></head></html>
"""
found = True
mime_type = "text/html"
else:
found, response, mime_type = self.http_server.process_request(path)

if isinstance(response, str):
response = response.encode("utf-8")
Expand Down
Loading

0 comments on commit deca696

Please sign in to comment.