Spaces:
Running
Running
Commit
·
dfaea14
1
Parent(s):
1614706
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,8 +82,12 @@ elif mode == "Train Mode":
|
|
| 82 |
image = tf.image.resize(image, (224, 224)) # adjust the size as needed
|
| 83 |
image = tf.expand_dims(image, axis=0)
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
# Train the model
|
| 86 |
-
model.fit(
|
| 87 |
|
| 88 |
st.success(f'Model has been trained with the new image and label.')
|
| 89 |
except Exception as e:
|
|
|
|
| 82 |
image = tf.image.resize(image, (224, 224)) # adjust the size as needed
|
| 83 |
image = tf.expand_dims(image, axis=0)
|
| 84 |
|
| 85 |
+
# Create a dataset with the new image and label
|
| 86 |
+
dataset = tf.data.Dataset.from_tensor_slices((image, target))
|
| 87 |
+
dataset = dataset.batch(1) # Batch size 1 as we are using a single image
|
| 88 |
+
|
| 89 |
# Train the model
|
| 90 |
+
model.fit(dataset, epochs=1) # You might want to adjust the number of epochs
|
| 91 |
|
| 92 |
st.success(f'Model has been trained with the new image and label.')
|
| 93 |
except Exception as e:
|