Spaces:
Sleeping

File size: 782 Bytes
a0e32ad
36f7d09
 
 
 
 
 
 
 
a0e32ad
36f7d09
 
 
 
9c8b746
36f7d09
 
a0e32ad
 
d9330de
a0e32ad
 
36f7d09
30c490f
36f7d09
 
a0e32ad
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

import os
import gradio as gr
import numpy as np
from PIL import Image
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import img_to_array

# Define the paths and filenames
model_path = "skin_model.h5"

# Load the model and label encoder
model = load_model(model_path)

class_names = ['Non_Cancer','Cancer']

def predict_input_image(img):
  img_4d=img.reshape(-1,100,100,3)
  prediction=model.predict(img_4d)[0]
  return {class_names[i]: float(prediction[i]) for i in range(1)}
image = gr.Image(shape=(100,100))
label = gr.Label(num_top_classes=2)

iface = gr.Interface(fn=predict_input_image, inputs=image, outputs=label,title="Cancer Vs Non Cancer",interpretation='default').launch(debug='True')

# Run the Gradio interface
iface.launch()