Spaces:
Runtime error
Runtime error
File size: 1,063 Bytes
1b63b70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import streamlit as st
from PIL import Image
from utils import generate, opencv_to_pil
algorithm_choices = [
"Sobel Edge Detection",
"Canny Edge Detection",
# "Hough Lines",
"Laplacian Edge Detection",
# "Contours Detection",
"Prewitt Edge Detection",
"Gradient Magnitude",
# "Corner Detection",
]
def main():
st.title("Line Detection Algorithms")
st.write("Upload an image and select a line detection algorithm.")
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
algorithm_choice = st.selectbox(
"Select Line Detection Algorithm", algorithm_choices
)
if uploaded_file is not None:
image = Image.open(uploaded_file)
st.image(image, caption="Uploaded Image", use_column_width=True)
if st.button("Generate Output"):
output = generate(image, algorithm_choice)
result = opencv_to_pil(output)
st.image(result, caption="Generated Output", use_column_width=True)
if __name__ == "__main__":
main()
|