File size: 855 Bytes
8d000e9
f93c90a
 
8d000e9
f93c90a
 
 
 
8d000e9
f93c90a
8d000e9
f93c90a
 
8d000e9
f93c90a
 
 
8d000e9
f93c90a
 
8d000e9
f93c90a
 
84cf0ea
8d000e9
f93c90a
 
 
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
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)