Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,17 +47,14 @@ def predict(image: Image.Image):
|
|
| 47 |
preds = model.predict(x)
|
| 48 |
class_idx = int(np.argmax(preds, axis=1)[0])
|
| 49 |
confidence = float(np.max(preds))
|
| 50 |
-
return
|
| 51 |
-
"class": class_names[class_idx],
|
| 52 |
-
"confidence": confidence
|
| 53 |
-
}
|
| 54 |
|
| 55 |
# ---- Gradio interface ----
|
| 56 |
interface = gr.Interface(
|
| 57 |
fn=predict,
|
| 58 |
inputs=gr.Image(type="pil", label="Upload an image"),
|
| 59 |
outputs=[
|
| 60 |
-
gr.Label(
|
| 61 |
gr.Number(label="Confidence")
|
| 62 |
],
|
| 63 |
title="NeuRecAI - Material Classifier",
|
|
|
|
| 47 |
preds = model.predict(x)
|
| 48 |
class_idx = int(np.argmax(preds, axis=1)[0])
|
| 49 |
confidence = float(np.max(preds))
|
| 50 |
+
return class_names[class_idx], confidence
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# ---- Gradio interface ----
|
| 53 |
interface = gr.Interface(
|
| 54 |
fn=predict,
|
| 55 |
inputs=gr.Image(type="pil", label="Upload an image"),
|
| 56 |
outputs=[
|
| 57 |
+
gr.Label(label="Predicted class"),
|
| 58 |
gr.Number(label="Confidence")
|
| 59 |
],
|
| 60 |
title="NeuRecAI - Material Classifier",
|