Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,10 +12,10 @@ model = AutoModelForImageClassification.from_pretrained(model_name)
|
|
12 |
# Define function for image preprocessing and prediction
|
13 |
def process_image(image):
|
14 |
img_4d=img.reshape(-1,256,256,3)
|
15 |
-
prediction=
|
16 |
-
return {class_names[i]: float(prediction[i]) for i in range(3)}
|
17 |
|
18 |
image = gr.inputs.Image(shape=(256,256))
|
19 |
-
label = gr.outputs.Label(num_top_classes=
|
20 |
|
21 |
gr.Interface(fn=predict_image, inputs=image, outputs=label,interpretation='default').launch()
|
|
|
12 |
# Define function for image preprocessing and prediction
|
13 |
def process_image(image):
|
14 |
img_4d=img.reshape(-1,256,256,3)
|
15 |
+
prediction=model.predict(img_4d)[0]
|
16 |
+
# return {class_names[i]: float(prediction[i]) for i in range(3)}
|
17 |
|
18 |
image = gr.inputs.Image(shape=(256,256))
|
19 |
+
label = gr.outputs.Label(num_top_classes=1)
|
20 |
|
21 |
gr.Interface(fn=predict_image, inputs=image, outputs=label,interpretation='default').launch()
|