Spaces:
Runtime error
Runtime error
Update app.py
Browse files22 unmodified lines2324252627288 unmodified lines3738394041424318 unmodified lines626364656667686970717222 unmodified linesprocessed_img = img / 255.0return processed_img# Keep the input size as (150, 150) since your model expects that sizeinput_size = (150, 150)img_resized = cv2.resize(img, input_size)8 unmodified lines"VGGNet": onnx_vggnet_model,# "InceptionV3": onnx_inception_model # Uncomment or remove based on your needs}[model_choice]input_name = model.get_inputs()[0].nametry:predictions = model.run(None, {input_name: img_preprocessed})18 unmodified linesreturn resultimage_input = gr.Image()# Create a Gradio interface with a dropdown for model selectioniface = gr.Interface(fn=classify_image,inputs=[image_input, gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")],outputs="json",live=True)22 unmodified lines2324252627282930318 unmodified lines4041424344454618 unmodified lines65666768697071727374757622 unmodified linesprocessed_img = img / 255.0return processed_img# Read the image using cv2.imreadimg = cv2.imdecode(np.frombuffer(img.read(), np.uint8), -1)# Keep the input size as (150, 150) since your model expects that sizeinput_size = (150, 150)img_resized = cv2.resize(img, input_size)8 unmodified lines"VGGNet": onnx_vggnet_model,# "InceptionV3": onnx_inception_model # Uncomment or remove based on your needs}[model_choice]input_name = model.get_inputs()[0].nametry:predictions = model.run(None, {input_name: img_preprocessed})18 unmodified linesreturn resultimage_input = gr.Image()model_dropdown = gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")# Create a Gradio interface with image input and a dropdown for model selectioniface = gr.Interface(fn=classify_image,inputs=[image_input, model_dropdown],outputs="json",live=True)
app.py+7-3