Skip to content

Commit 9dd6b4c

Browse files
committed
improve whisper transcribe apt regex
1 parent d8c174b commit 9dd6b4c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

koboldcpp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,8 +2743,8 @@ def extract_formdata_from_file_upload(self, body):
27432743
if boundary:
27442744
fparts = body.split(boundary)
27452745
for fpart in fparts:
2746-
detected_upload_filename = re.findall(r'Content-Disposition.*name="file"; filename="(.*)"', fpart.decode('utf-8',errors='ignore'))
2747-
detected_upload_filename_comfy = re.findall(r'Content-Disposition.*name="image"; filename="(.*)"', fpart.decode('utf-8',errors='ignore'))
2746+
detected_upload_filename = re.findall(r'Content-Disposition[^;]*;\s*name=(?:"file"|file)\s*;\s*filename="([^"]+)"', fpart.decode('utf-8',errors='ignore'),flags=re.IGNORECASE)
2747+
detected_upload_filename_comfy = re.findall(r'Content-Disposition[^;]*;\s*name=(?:"image"|image)\s*;\s*filename="([^"]+)""', fpart.decode('utf-8',errors='ignore'),flags=re.IGNORECASE)
27482748
if detected_upload_filename and len(detected_upload_filename)>0:
27492749
utfprint(f"Detected uploaded file: {detected_upload_filename[0]}")
27502750
file_content_start = fpart.find(b'\r\n\r\n') + 4 # Position after headers

otherarch/whispercpp/whisper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3490,7 +3490,7 @@ struct whisper_context_params whisper_context_default_params() {
34903490
}
34913491

34923492
struct whisper_context * whisper_init_from_file_with_params_no_state(const char * path_model, struct whisper_context_params params) {
3493-
WHISPER_LOG_INFO("%s: loading model from '%s'\n", __func__, path_model);
3493+
WHISPER_LOG_INFO("\n%s: loading model from '%s'\n", __func__, path_model);
34943494
#ifdef _MSC_VER
34953495
// Convert UTF-8 path to wide string (UTF-16) for Windows, resolving character encoding issues.
34963496
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;

0 commit comments

Comments
 (0)