Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,12 @@ import tensorflow as tf
|
|
5 |
from tensorflow.keras.preprocessing import image
|
6 |
import numpy as np
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
# Load your trained Xception model
|
10 |
-
model = tf.keras.models.load_model("https://huggingface.co/icputrd/gelderman_decomposition_classification/blob/main/head/xception_070523")
|
11 |
|
12 |
def classify_image(img):
|
13 |
# Preprocess the image
|
@@ -22,7 +25,6 @@ def classify_image(img):
|
|
22 |
|
23 |
return str(predicted_class) # Return the class index as a string
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
|
28 |
-
iface.launch()
|
|
|
5 |
from tensorflow.keras.preprocessing import image
|
6 |
import numpy as np
|
7 |
|
8 |
+
import gradio as gr
|
9 |
+
from transformers import pipeline
|
10 |
+
|
11 |
+
# Load image classification model from Hugging Face
|
12 |
+
model = pipeline("image-classification", model="icputrd/gelderman_decomposition_classification/head/xception_070523")
|
13 |
|
|
|
|
|
14 |
|
15 |
def classify_image(img):
|
16 |
# Preprocess the image
|
|
|
25 |
|
26 |
return str(predicted_class) # Return the class index as a string
|
27 |
|
28 |
+
# Gradio interface for image classification
|
29 |
+
demo = gr.Interface(fn=classify_image, inputs=gr.inputs.Image(type="pil"), outputs="label")
|
30 |
+
demo.launch()
|
|