Download src/streamlit_app.py from devansh71/test: direct link, hf CLI and curl.
- Browser
- Download file 855 Bytes
-
https://huggingface.co/spaces/devansh71/test/resolve/main/src/streamlit_app.py
- Command line
-
hf download hf://spaces/devansh71/test/src/streamlit_app.py
-
curl -L -o streamlit_app.py https://huggingface.co/spaces/devansh71/test/resolve/main/src/streamlit_app.py
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) |