Spaces:
No application file
No application file
| import gradio as gr | |
| import tensorflow as tf | |
| from tensorflow.keras.models import load_model | |
| import numpy as np | |
| # Load your model | |
| model = load_model('vgg19_binary_nonbinary.h5') | |
| def predict(image): | |
| image = image.resize((224, 224)) # Resize to match model input | |
| image = np.array(image) / 255.0 | |
| image = np.expand_dims(image, axis=0) | |
| prediction = model.predict(image) | |
| return "Non-binary" if prediction[0][0] > 0.5 else "Binary" | |
| iface = gr.Interface(fn=predict, inputs="image", outputs="text", title="Non-binary Image Classifier") | |
| iface.launch() |