Spaces:
Runtime error
Runtime error
abd6.py
#6
by
abdabbas
- opened
- app.py +1 -12
- target_xception_model.h5 +0 -3
app.py
CHANGED
|
@@ -1,21 +1,10 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
|
| 3 |
-
import tensorflow
|
| 4 |
-
from tensorflow.keras.models import load_model
|
| 5 |
-
#from livelossplot import PlotLossesKeras
|
| 6 |
-
#from keras.models import load_model
|
| 7 |
-
|
| 8 |
-
model = load_model('target_xception_model.h5')
|
| 9 |
-
|
| 10 |
-
class_names={0:'خبيث',1:'حميد'}
|
| 11 |
-
|
| 12 |
def predict_image(img):
|
| 13 |
img_4d=img.reshape(-1,299,299,3)
|
| 14 |
img_4d=img_4d/255
|
| 15 |
prediction=model.predict(img_4d)[0]
|
| 16 |
#prediction = [1 if x>0.5 else 0 for x in prediction]
|
| 17 |
return {class_names[i]: float(prediction[i]) for i in range(1)}
|
| 18 |
-
|
| 19 |
image = gr.inputs.Image(shape=(299,299))
|
| 20 |
label = gr.outputs.Label(num_top_classes=1)
|
| 21 |
gr.Interface(fn=predict_image, inputs=image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def predict_image(img):
|
| 2 |
img_4d=img.reshape(-1,299,299,3)
|
| 3 |
img_4d=img_4d/255
|
| 4 |
prediction=model.predict(img_4d)[0]
|
| 5 |
#prediction = [1 if x>0.5 else 0 for x in prediction]
|
| 6 |
return {class_names[i]: float(prediction[i]) for i in range(1)}
|
| 7 |
+
import gradio as gr
|
| 8 |
image = gr.inputs.Image(shape=(299,299))
|
| 9 |
label = gr.outputs.Label(num_top_classes=1)
|
| 10 |
gr.Interface(fn=predict_image, inputs=image,
|
target_xception_model.h5
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:9687877177f9e4692e127e0b366775424c2093da53fcd078eec52601ecb8a008
|
| 3 |
-
size 136052112
|
|
|
|
|
|
|
|
|
|
|
|