Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,6 +43,14 @@ with gr.Blocks() as demo:
|
|
43 |
test_loss, test_acc = model.evaluate(x_test, y_test, verbose=2)
|
44 |
|
45 |
return('\nTest accuracy:', test_acc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
48 |
# Creates the Gradio interface objects
|
@@ -50,8 +58,11 @@ with gr.Blocks() as demo:
|
|
50 |
with gr.Column(scale=1):
|
51 |
submit_btn = gr.Button(value="Train/Eval")
|
52 |
with gr.Column(scale=2):
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
|
56 |
|
57 |
# creates a local web server
|
|
|
43 |
test_loss, test_acc = model.evaluate(x_test, y_test, verbose=2)
|
44 |
|
45 |
return('\nTest accuracy:', test_acc)
|
46 |
+
|
47 |
+
def predict_image(img):
|
48 |
+
# Define any necessary preprocessing steps for the image input here
|
49 |
+
# Make a prediction using the model
|
50 |
+
prediction = model.predict(preprocessed_img)
|
51 |
+
|
52 |
+
# Postprocess the prediction and return it
|
53 |
+
return prediction
|
54 |
|
55 |
|
56 |
# Creates the Gradio interface objects
|
|
|
58 |
with gr.Column(scale=1):
|
59 |
submit_btn = gr.Button(value="Train/Eval")
|
60 |
with gr.Column(scale=2):
|
61 |
+
model_performance = gr.Text(label="Model Performance", interactive=False)
|
62 |
+
model_prediction = gr.Text(label="Model Prediction", interactive=False)
|
63 |
+
image_data = gr.Image(label="Upload Image")
|
64 |
+
submit_btn.click(modelTraining, [], model_performance)
|
65 |
+
image_data.change(predict_image, image_data, model_prediction)
|
66 |
|
67 |
|
68 |
# creates a local web server
|