add: initial_prompt args
This commit is contained in:
@@ -125,6 +125,7 @@ async def konele_ws(
|
|||||||
websocket: WebSocket,
|
websocket: WebSocket,
|
||||||
task: Literal["transcribe", "translate"] = "transcribe",
|
task: Literal["transcribe", "translate"] = "transcribe",
|
||||||
lang: str = "und",
|
lang: str = "und",
|
||||||
|
initial_prompt: str = "",
|
||||||
):
|
):
|
||||||
await websocket.accept()
|
await websocket.accept()
|
||||||
print("WebSocket client connected, lang is", lang)
|
print("WebSocket client connected, lang is", lang)
|
||||||
@@ -151,7 +152,7 @@ async def konele_ws(
|
|||||||
buffer.writeframes(data)
|
buffer.writeframes(data)
|
||||||
file_obj.seek(0)
|
file_obj.seek(0)
|
||||||
|
|
||||||
options = get_options()
|
options = get_options(initial_prompt=initial_prompt)
|
||||||
|
|
||||||
result = transcriber.inference(
|
result = transcriber.inference(
|
||||||
audio=file_obj,
|
audio=file_obj,
|
||||||
@@ -182,6 +183,7 @@ async def translateapi(
|
|||||||
request: Request,
|
request: Request,
|
||||||
task: Literal["transcribe", "translate"] = "transcribe",
|
task: Literal["transcribe", "translate"] = "transcribe",
|
||||||
lang: str = "und",
|
lang: str = "und",
|
||||||
|
initial_prompt: str = "",
|
||||||
):
|
):
|
||||||
content_type = request.headers.get("Content-Type", "")
|
content_type = request.headers.get("Content-Type", "")
|
||||||
print("downloading request file", content_type)
|
print("downloading request file", content_type)
|
||||||
@@ -205,7 +207,7 @@ async def translateapi(
|
|||||||
buffer.writeframes(body)
|
buffer.writeframes(body)
|
||||||
file_obj.seek(0)
|
file_obj.seek(0)
|
||||||
|
|
||||||
options = get_options()
|
options = get_options(initial_prompt=initial_prompt)
|
||||||
|
|
||||||
result = transcriber.inference(
|
result = transcriber.inference(
|
||||||
audio=file_obj,
|
audio=file_obj,
|
||||||
|
|||||||
Reference in New Issue
Block a user