Update pages/Life_cycle_of_ML.py
Browse files
pages/Life_cycle_of_ML.py
CHANGED
|
@@ -656,7 +656,7 @@ def table():
|
|
| 656 |
image = cv2.imdecode(image_array, cv2.IMREAD_COLOR)
|
| 657 |
|
| 658 |
# Show the original image
|
| 659 |
-
st.image(image, caption=f"Original Image: {uploaded_file.name}",
|
| 660 |
|
| 661 |
# Step 2: Convert image based on the selected option
|
| 662 |
if processing_option == "Convert to Grayscale and Tabular Data":
|
|
@@ -670,7 +670,7 @@ def table():
|
|
| 670 |
processed_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
| 671 |
|
| 672 |
# Show the grayscale image
|
| 673 |
-
st.image(processed_image, caption=f"Grayscale Image: {uploaded_file.name}"
|
| 674 |
|
| 675 |
else:
|
| 676 |
st.write("### Step 2: Keep as Color")
|
|
@@ -683,7 +683,7 @@ def table():
|
|
| 683 |
processed_image = image
|
| 684 |
|
| 685 |
# Show the color image
|
| 686 |
-
st.image(processed_image, caption=f"Color Image: {uploaded_file.name}",
|
| 687 |
|
| 688 |
# Step 3: Resize image to 100x100 pixels using OpenCV
|
| 689 |
st.write("### Step 3: Resize the Image")
|
|
@@ -696,7 +696,10 @@ def table():
|
|
| 696 |
resized_image = cv2.resize(processed_image, (100, 100))
|
| 697 |
|
| 698 |
# Show the resized image
|
| 699 |
-
|
|
|
|
|
|
|
|
|
|
| 700 |
|
| 701 |
# Step 4: Flatten the image into a 1D array
|
| 702 |
st.write("### Step 4: Flatten the Image")
|
|
@@ -730,7 +733,6 @@ def table():
|
|
| 730 |
st.write("### Combined DataFrame from All Images")
|
| 731 |
st.dataframe(all_image_data) # Display the combined DataFrame
|
| 732 |
|
| 733 |
-
|
| 734 |
|
| 735 |
|
| 736 |
if 'page' not in st.session_state:
|
|
|
|
| 656 |
image = cv2.imdecode(image_array, cv2.IMREAD_COLOR)
|
| 657 |
|
| 658 |
# Show the original image
|
| 659 |
+
st.image(image, caption=f"Original Image: {uploaded_file.name}", channels="BGR")
|
| 660 |
|
| 661 |
# Step 2: Convert image based on the selected option
|
| 662 |
if processing_option == "Convert to Grayscale and Tabular Data":
|
|
|
|
| 670 |
processed_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
| 671 |
|
| 672 |
# Show the grayscale image
|
| 673 |
+
st.image(processed_image, caption=f"Grayscale Image: {uploaded_file.name}")
|
| 674 |
|
| 675 |
else:
|
| 676 |
st.write("### Step 2: Keep as Color")
|
|
|
|
| 683 |
processed_image = image
|
| 684 |
|
| 685 |
# Show the color image
|
| 686 |
+
st.image(processed_image, caption=f"Color Image: {uploaded_file.name}", channels="BGR")
|
| 687 |
|
| 688 |
# Step 3: Resize image to 100x100 pixels using OpenCV
|
| 689 |
st.write("### Step 3: Resize the Image")
|
|
|
|
| 696 |
resized_image = cv2.resize(processed_image, (100, 100))
|
| 697 |
|
| 698 |
# Show the resized image
|
| 699 |
+
if len(resized_image.shape) == 2: # Grayscale image
|
| 700 |
+
st.image(resized_image, caption=f"Resized Image: {uploaded_file.name}")
|
| 701 |
+
else: # Color image
|
| 702 |
+
st.image(resized_image, caption=f"Resized Image: {uploaded_file.name}", channels="BGR")
|
| 703 |
|
| 704 |
# Step 4: Flatten the image into a 1D array
|
| 705 |
st.write("### Step 4: Flatten the Image")
|
|
|
|
| 733 |
st.write("### Combined DataFrame from All Images")
|
| 734 |
st.dataframe(all_image_data) # Display the combined DataFrame
|
| 735 |
|
|
|
|
| 736 |
|
| 737 |
|
| 738 |
if 'page' not in st.session_state:
|