Spaces:
Runtime error
Runtime error
Update app.py
Browse files3 unmodified lines4567895 unmodified lines15161718192021222324253 unmodified linesfrom PIL import Imageimport onnxonnx_efficientnet_path = './Models_onnx/efficientnet.onnx'onnx_inception_path = './Models_onnx/inceptionv3.onnx'onnx_vggnet_path = './Models_onnx/vgg_16.onnx'5 unmodified linesvggnet_model = onnx.load(onnx_vggnet_path)resnet_model = onnx.load(onnx_resnet_path)# Load PyTorch modelspytorch_efficientnet_model = torch.jit.load(torch.onnx.export_to_pretty_string(efficientnet_model, verbose=True))pytorch_inceptionv3_model = torch.jit.load(torch.onnx.export_to_pretty_string(inceptionv3_model, verbose=True))pytorch_vggnet_model = torch.jit.load(torch.onnx.export_to_pretty_string(vggnet_model, verbose=True))pytorch_resnet_model = torch.jit.load(torch.onnx.export_to_pretty_string(resnet_model, verbose=True))class_names = ["Ajloun Castle", "Jerash", "Petra", "Roman amphitheater", "Umm Qais", "Wadi Rum"]def preprocess_image_pil(img):3 unmodified lines4567891011125 unmodified lines18192021222324252627282930313233343536373 unmodified linesfrom PIL import Imageimport onnximport torchimport onnxonnx_efficientnet_path = './Models_onnx/efficientnet.onnx'onnx_inception_path = './Models_onnx/inceptionv3.onnx'onnx_vggnet_path = './Models_onnx/vgg_16.onnx'5 unmodified linesvggnet_model = onnx.load(onnx_vggnet_path)resnet_model = onnx.load(onnx_resnet_path)# Export ONNX models to PyTorch modelspytorch_efficientnet_model = torch.onnx.export(efficientnet_model, torch.randn(1, 3, 150, 150), verbose=True)pytorch_inceptionv3_model = torch.onnx.export(inceptionv3_model, torch.randn(1, 3, 150, 150), verbose=True)pytorch_vggnet_model = torch.onnx.export(vggnet_model, torch.randn(1, 3, 150, 150), verbose=True)pytorch_resnet_model = torch.onnx.export(resnet_model, torch.randn(1, 3, 150, 150), verbose=True)# Load PyTorch modelspytorch_efficientnet_model = torch.jit.load(pytorch_efficientnet_model)pytorch_inceptionv3_model = torch.jit.load(pytorch_inceptionv3_model)pytorch_vggnet_model = torch.jit.load(pytorch_vggnet_model)pytorch_resnet_model = torch.jit.load(pytorch_resnet_model)class_names = ["Ajloun Castle", "Jerash", "Petra", "Roman amphitheater", "Umm Qais", "Wadi Rum"]def preprocess_image_pil(img):
app.py+16-4