andrewzamp's picture
Create app.py
64d14f7
raw
history blame
790 Bytes
# Import the libraries
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from tensorflow.keras.models import load_model # type: ignore
from tensorflow.keras.preprocessing.image import load_img, img_to_array # type: ignore
from tensorflow.keras.applications.convnext import preprocess_input # type: ignore
import gradio as gr
# Define the Gradio interface
interface = gr.Interface(
fn=make_prediction, # Function to be called for predictions
inputs=gr.Image(type="pil"), # Input type: Image (PIL format)
outputs="html", # Output type: HTML for formatting
title="Amazon arboreal species classification",
description="Upload an image to classify the species."
)
# Launch the Gradio interface
interface.launch()