Spaces:
Sleeping
Sleeping
Commit
·
64d14f7
1
Parent(s):
5d7637d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Import the libraries
|
2 |
+
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
+
from sklearn.preprocessing import LabelEncoder
|
5 |
+
from tensorflow.keras.models import load_model # type: ignore
|
6 |
+
from tensorflow.keras.preprocessing.image import load_img, img_to_array # type: ignore
|
7 |
+
from tensorflow.keras.applications.convnext import preprocess_input # type: ignore
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# Define the Gradio interface
|
11 |
+
interface = gr.Interface(
|
12 |
+
fn=make_prediction, # Function to be called for predictions
|
13 |
+
inputs=gr.Image(type="pil"), # Input type: Image (PIL format)
|
14 |
+
outputs="html", # Output type: HTML for formatting
|
15 |
+
title="Amazon arboreal species classification",
|
16 |
+
description="Upload an image to classify the species."
|
17 |
+
)
|
18 |
+
|
19 |
+
# Launch the Gradio interface
|
20 |
+
interface.launch()
|