Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
import numpy as np
|
@@ -7,14 +9,14 @@ import tensorflow.keras as keras
|
|
7 |
|
8 |
from tensorflow.keras.models import load_model
|
9 |
|
10 |
-
model=load_model("
|
11 |
|
12 |
classnames=["Benign","Malignant"]
|
13 |
|
14 |
def predict_image(img):
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
image=gr.inputs.Image(shape=(299,299))
|
20 |
label=gr.outputs.Label(num_top_classes=2)
|
@@ -22,5 +24,4 @@ label=gr.outputs.Label(num_top_classes=2)
|
|
22 |
article="<p style='text-align: center'>Made by Team AAA</p>"
|
23 |
|
24 |
|
25 |
-
gr.Interface(fn=predict_image,inputs=image,title="Skin Cancer Detection ",description="A Deep CNN Project using Xception Model to detect Skin Cancer ",outputs=label,article=article,enable_queue=True,interpretation='default').launch()
|
26 |
-
|
|
|
1 |
+
from tensorflow.keras.applications.xception import Xception
|
2 |
+
import keras.applications.xception as xception
|
3 |
import gradio as gr
|
4 |
import tensorflow as tf
|
5 |
import numpy as np
|
|
|
9 |
|
10 |
from tensorflow.keras.models import load_model
|
11 |
|
12 |
+
model=load_model("Model.h5")
|
13 |
|
14 |
classnames=["Benign","Malignant"]
|
15 |
|
16 |
def predict_image(img):
|
17 |
+
img_4d=img.reshape(-1,299,299,3)
|
18 |
+
prediction=model.predict(img_4d)[0]
|
19 |
+
return {classnames[i]: float(prediction[i]) for i in range(2)}
|
20 |
|
21 |
image=gr.inputs.Image(shape=(299,299))
|
22 |
label=gr.outputs.Label(num_top_classes=2)
|
|
|
24 |
article="<p style='text-align: center'>Made by Team AAA</p>"
|
25 |
|
26 |
|
27 |
+
gr.Interface(fn=predict_image,inputs=image,title="Skin Cancer Detection ",description="A Deep CNN Project using Xception Model to detect Skin Cancer ",outputs=label,article=article,enable_queue=True,interpretation='default').launch()
|
|