Spaces:
Runtime error
Runtime error
Update app.py
Browse files2 unmodified lines345678910111213141516171819202 unmodified linesimport gradio as grfrom PIL import Image# Assuming you have the PyTorch models saved in the specified pathspytorch_efficientnet_path = './Models_pytorch/efficientnet.pth'pytorch_inception_path = './Models_pytorch/inceptionv3.pth'pytorch_vggnet_path = './Models_pytorch/vgg_16.pth'pytorch_resnet_path = './Models_pytorch/resnet50.pth'# Load PyTorch modelspytorch_efficientnet_model = torch.load(pytorch_efficientnet_path)pytorch_inception_model = torch.load(pytorch_inception_path)pytorch_vggnet_model = torch.load(pytorch_vggnet_path)pytorch_resnet_model = torch.load(pytorch_resnet_path)class_names = ["Ajloun Castle", "Jerash", "Petra", "Roman amphitheater", "Umm Qais", "Wadi Rum"]def preprocess_image_pil(img):2 unmodified lines34567891011121314151617181920212223242 unmodified linesimport gradio as grfrom PIL import Imageonnx_efficientnet_path = './Models_onnx/efficientnet.onnx'onnx_inception_path = './Models_onnx/inceptionv3.onnx'onnx_vggnet_path = './Models_onnx/vgg_16.onnx'onnx_resnet_path = './Models_onnx/resnet50.onnx'# Convert ONNX models to PyTorch modelsefficientnet_model = ConvertModel(onnx.load(onnx_efficientnet_path))inceptionv3_model = ConvertModel(onnx.load(onnx_inception_path))vggnet_model = ConvertModel(onnx.load(onnx_vggnet_path))resnet_model = ConvertModel(onnx.load(onnx_resnet_path))# Load PyTorch modelspytorch_efficientnet_model = torch.jit.load(efficientnet_model)pytorch_inceptionv3_model = torch.jit.load(inceptionv3_model)pytorch_vggnet_model = torch.jit.load(vggnet_model)pytorch_resnet_model = torch.jit.load(resnet_model)class_names = ["Ajloun Castle", "Jerash", "Petra", "Roman amphitheater", "Umm Qais", "Wadi Rum"]def preprocess_image_pil(img):
app.py+14-10