-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f056614
commit 2301f53
Showing
5 changed files
with
141 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
import streamlit as st | ||
from PIL import Image | ||
from preprocess_image import grayscale_contrast | ||
|
||
# Title of the app | ||
st.title("Document Extraction") | ||
|
||
# Image uploader in the sidebar | ||
uploaded_image = st.sidebar.file_uploader("**Upload Image**", | ||
type=["jpg", "jpeg", "png"]) | ||
|
||
# Main content area | ||
st.write("### Image Preview") | ||
|
||
if uploaded_image is not None: | ||
# Open the uploaded image using PIL | ||
image = Image.open(uploaded_image) | ||
if uploaded_image: | ||
st.write("### Image Preview") | ||
|
||
# Display the original image | ||
st.image(image, caption="Uploaded Image", use_column_width=True) | ||
|
||
# Placeholder for processed image (for demonstration, we'll just display the same image) | ||
processed_image = image # Replace this with your image processing function | ||
|
||
# Display the processed image | ||
st.write("### Processed Image") | ||
st.image(processed_image, caption="Processed Image", use_column_width=True) | ||
# original_image = Image.open(uploaded_image) | ||
st.image(uploaded_image, caption="Uploaded Image", use_column_width=True) | ||
|
||
# Optionally, you can add a button to trigger processing | ||
if st.sidebar.button("Process Image"): | ||
# Add your image processing logic here | ||
st.success("Image processed successfully!") | ||
else: | ||
st.info("Please upload an image to see the results.") | ||
if st.button("Process Image"): | ||
# Process the uploaded image | ||
preprocessed_image = grayscale_contrast(uploaded_image) | ||
|
||
if preprocessed_image: | ||
# Display the processed image | ||
st.write("### Processed Image") | ||
st.image(preprocessed_image, | ||
caption="Processed Image", | ||
use_column_width=True) | ||
st.success("Image processed successfully!") | ||
else: | ||
st.info("Please upload an image to see the results.") |
Oops, something went wrong.