Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from PIL import Image | |
| import tensorflow as tf | |
| import numpy as np | |
| # Model load koro (example: EfficientNetB3) | |
| model = tf.keras.models.load_model("model.h5") # model.h5 file upload koro | |
| # Class names (modify koro jodi dorkar hoy) | |
| class_names = ["Monkeypox", "Not Monkeypox"] | |
| def predict(image): | |
| # Image resize & preprocess (modify koro jodi dorkar hoy) | |
| img = image.resize((224, 224)) | |
| img = np.array(img) / 255.0 | |
| img = np.expand_dims(img, axis=0) | |
| pred = model.predict(img) | |
| label = class_names[np.argmax(pred)] | |
| confidence = np.max(pred) | |
| return f"{label} ({confidence*100:.2f}%)" | |
| iface = gr.Interface( | |
| fn=predict, | |
| inputs=gr.Image(type="pil"), | |
| outputs="text", | |
| title="Monkeypox Detection", | |
| description="Upload a skin image to check for Monkeypox." | |
| ) | |
| iface.launch() |