Spaces:
Runtime error
Runtime error
xxx
Browse files
app.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
11 |
+
outputs=label).launch(debug='False',share=True)
|