I am getting the same error here again and again which is Image module not found I want to use to image module of fastai but seem to get the same error again and again please help me .. I am also encountering error for the load_learner() function. I'm encountering an issue with my Flask application where I'm consistently getting the error message "Image module not found."
from fastai import *
from fastai.vision import *
from fastai.data.external import *
import yaml
import sys
from io import BytesIO
from typing import List, Dict, Union, ByteString, Any
import os
import flask
from flask import Flask
import requests
import torch
import json
def load_model(path=".", model_name="export.pkl"):
learn = load_learner(path, file=model_name)
return learn.to_fp32()
def load_image_url(url: str) -> Image:
response = requests.get(url)
img = Image.open(BytesIO(response.content))
return img
def load_image_bytes(raw_bytes: ByteString) -> Image:
img = Image.open(BytesIO(raw_bytes))
return img
Kindly make the following imports. Make sure you have necessary packages installed which are fastai, pillow and flask. You can run pip install fastai pillow flask for installing these packages.