Spaces:
Runtime error
Runtime error
File size: 1,034 Bytes
00e6576 58cb436 42155bf 00e6576 42155bf 58cb436 42155bf 00e6576 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
from huggingface_hub import from_pretrained_keras
from tensorflow.keras.preprocessing import image
import numpy as np
# Load models
idpred = from_pretrained_keras("aegishield/idpred")
fingpred = from_pretrained_keras("aegishield/fingpred")
def predict_image(img):
# Preprocess the image (example, adjust based on your model's needs)
img = img.resize((224, 224)) # Adjust the size according to your model input
img_array = image.img_to_array(img)
img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
# Predictions
y_SubjectID_pred = idpred.predict(img_array)
y_fingerNum_pred = fingpred.predict(img_array)
# Process predictions to readable format if necessary
# For example, if your predictions are one-hot encoded, convert them to labels
return f'Subject ID: {y_SubjectID_pred[0]}, Finger Number: {y_fingerNum_pred[0]}'
# Create Gradio interface
iface = gr.Interface(fn=predict_image, inputs="image", outputs="text")
# Launch interface
iface.launch() |