import streamlit as st import tensorflow as tf import numpy as np import cv2 from huggingface_hub import hf_hub_download from tensorflow.keras.models import load_model from io import BytesIO from PIL import Image import requests # Authenticate and download model from Hugging Face repo_id = "Hammad712/closed_eye_detection" filename = "Closed_Eye_Detection_98.h5" model_path = hf_hub_download(repo_id=repo_id, filename=filename) # Load the downloaded model model = load_model(model_path) # Set image dimensions img_height, img_width = 150, 150 # Custom CSS def set_css(style): st.markdown(f"", unsafe_allow_html=True) combined_css = """ .main, .sidebar .sidebar-content { background-color: #1c1c1c; color: #f0f2f6; } .block-container { padding: 1rem 2rem; background-color: #333; border-radius: 10px; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5); } .stButton>button, .stDownloadButton>button { background: linear-gradient(135deg, #ff7e5f, #feb47b); color: white; border: none; padding: 10px 24px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 5px; } .stSpinner { color: #4CAF50; } .title { font-size: 3rem; font-weight: bold; display: flex; align-items: center; justify-content: center; } .colorful-text { background: -webkit-linear-gradient(135deg, #ff7e5f, #feb47b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .black-white-text { color: black; } .small-input .stTextInput>div>input { height: 2rem; font-size: 0.9rem; } .small-file-uploader .stFileUploader>div>div { height: 2rem; font-size: 0.9rem; } .custom-text { font-size: 1.2rem; color: #feb47b; text-align: center; margin-top: -20px; margin-bottom: 20px; } """ # Streamlit application st.set_page_config(layout="wide") st.markdown(f"", unsafe_allow_html=True) st.markdown('