fix(effi-ocr): explicitly set content-type from mimetypes when sending file

This commit is contained in:
Folzo
2026-04-11 02:17:57 +02:00
parent 35486244fe
commit eebebd64f1
+7 -1
View File
@@ -42,8 +42,14 @@ class Tools:
available = self._list_files()
return "[ERROR] File not found: " + image_path + "\n\nAvailable files:\n" + available
import mimetypes
mime_type, _ = mimetypes.guess_type(file_path)
mime_type = mime_type or 'image/jpeg'
with open(file_path, 'rb') as f:
files = {'file': (os.path.basename(file_path), f)}
files = {
'file': (os.path.basename(file_path), f, mime_type)
}
data = {'lang': self._normalize_language(language), 'preprocess': 'true'}
response = requests.post(