test / src /streamlit_app.py
devansh71's picture
Update src/streamlit_app.py
84cf0ea verified
raw
history blame contribute delete
855 Bytes
import streamlit as st
import numpy as np
from PIL import Image
# Dummy model function (replace this with your own)
def model(input_image):
# Example: convert to grayscale and return message
return input_image, 'you are sleepy'
st.title("πŸ“· Webcam Image Processor")
# Webcam input using Streamlit's native method
img_file_buffer = st.camera_input("Take a picture")
if img_file_buffer is not None:
# Convert captured image to PIL Image
input_image = Image.open(img_file_buffer)
st.subheader("πŸ” Input Image")
st.image(input_image, caption="Captured Image", use_column_width=True)
# Run through model
output_image, result_text = model(input_image)
print('processed')
st.subheader("🧠 Model Output")
st.image(output_image, caption="Processed Output", use_column_width=True)
st.success(result_text)