mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 11:19:05 +08:00
Fix t_ocr.py for PNG image. (#4625)
### What problem does this PR solve? #4586 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
e9ccba0395
commit
1bff6b7333
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
import io
|
||||||
|
|
||||||
import pdfplumber
|
import pdfplumber
|
||||||
|
|
||||||
@ -48,7 +49,10 @@ def init_in_out(args):
|
|||||||
pdf_pages(fnm)
|
pdf_pages(fnm)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
images.append(Image.open(fnm))
|
fp = open(fnm, 'rb')
|
||||||
|
binary = fp.read()
|
||||||
|
fp.close()
|
||||||
|
images.append(Image.open(io.BytesIO(binary)).convert('RGB'))
|
||||||
outputs.append(os.path.split(fnm)[-1])
|
outputs.append(os.path.split(fnm)[-1])
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user