fix(effi-ocr): explicitly set content-type from mimetypes when sending file
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user