Spaces:
Runtime error
Runtime error
Update app.py
Browse files4 unmodified lines5678910111213141516171819202122232425267 unmodified lines343536373839404 unmodified linesimport kerasfrom huggingface_hub import hf_hub_download# эмоции RAF-DB / CK+labels = ["angry", "disgust", "fear", "happy", "neutral", "sad", "surprise"]st.set_page_config(page_title="Emotion AI", page_icon="🧠", layout="centered")st.markdown("""<h1 style='text-align:center;'>🧠 Emotion Recognition AI</h1><p style='text-align:center;'>Upload a face image and detect emotion</p>""", unsafe_allow_html=True)# 🔥 загрузка модели (ВАЖНО: поменяй имя файла .h5)@st.cache_resourcedef load_model():model_path = hf_hub_download(repo_id="fdfddfdsaassd/vgg19-emotion-recognition-ckplus-rafdb",filename="model.h5" # ⬅️ ВОТ ЭТО ЗАМЕНИ НА РЕАЛЬНОЕ ИМЯ)return keras.models.load_model(model_path, compile=False)7 unmodified linesimg = np.array(img)# RGBA → RGBif img.shape[-1] == 4:img = cv2.cvtColor(img, cv2.COLOR_RGBA2RGB)4 unmodified lines567891011121314151617181920212223247 unmodified lines3233343536374 unmodified linesimport kerasfrom huggingface_hub import hf_hub_downloadlabels = ["angry", "disgust", "fear", "happy", "neutral", "sad", "surprise"]st.set_page_config(page_title="Emotion AI", page_icon="🧠", layout="centered")st.markdown("""<h1 style='text-align:center;'>🧠 Emotion Recognition AI</h1><p style='text-align:center;'>Upload a face image to detect emotion</p>""", unsafe_allow_html=True)@st.cache_resourcedef load_model():model_path = hf_hub_download(repo_id="fdfddfdsaassd/vgg19-emotion-recognition-ckplus-rafdb",filename="emotion_vgg19_model.h5")return keras.models.load_model(model_path, compile=False)7 unmodified linesimg = np.array(img)if img.shape[-1] == 4:img = cv2.cvtColor(img, cv2.COLOR_RGBA2RGB)
app.py+2-5