Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import tensorflow as tf | |
| import os | |
| def create_path_name(file_path, folder_path): | |
| return folder_path + file_path | |
| path_monkeyPox = "./data/Original Images/Original Images/Monkey Pox/" | |
| path_other = "./data/Original Images/Original Images/Others/" | |
| monkeyPox_data = list(map(lambda x : create_path_name(x,path_monkeyPox), os.listdir(path_monkeyPox))) | |
| other_data = list(map(lambda x : create_path_name(x,path_other), os.listdir(path_other))) | |
| model = tf.keras.models.load_model('./monkey pox_82.75.h5') | |
| def classify_image(img): | |
| img = img.reshape((-1,224,224,3)) | |
| prediction = model.predict(img).flatten() | |
| confidences = {'monkeypox': float(prediction[0]), 'other':float(prediction[1])} | |
| return confidences | |
| gr.Interface(fn=classify_image, | |
| inputs=gr.Image(shape=(224,224)), | |
| outputs=gr.Label(), | |
| examples=[monkeyPox_data[0], monkeyPox_data[1], other_data[0], other_data[1]] | |
| ).launch() |