fdfddfdsaassd commited on
Commit
cccfea0
·
verified ·
1 Parent(s): 7329d33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -5,22 +5,20 @@ from PIL import Image
5
  import keras
6
  from huggingface_hub import hf_hub_download
7
 
8
- # эмоции RAF-DB / CK+
9
  labels = ["angry", "disgust", "fear", "happy", "neutral", "sad", "surprise"]
10
 
11
  st.set_page_config(page_title="Emotion AI", page_icon="🧠", layout="centered")
12
 
13
  st.markdown("""
14
  <h1 style='text-align:center;'>🧠 Emotion Recognition AI</h1>
15
- <p style='text-align:center;'>Upload a face image and detect emotion</p>
16
  """, unsafe_allow_html=True)
17
 
18
- # 🔥 загрузка модели (ВАЖНО: поменяй имя файла .h5)
19
  @st.cache_resource
20
  def load_model():
21
  model_path = hf_hub_download(
22
  repo_id="fdfddfdsaassd/vgg19-emotion-recognition-ckplus-rafdb",
23
- filename="model.h5" # ⬅️ ВОТ ЭТО ЗАМЕНИ НА РЕАЛЬНОЕ ИМЯ
24
  )
25
  return keras.models.load_model(model_path, compile=False)
26
 
@@ -34,7 +32,6 @@ if file:
34
 
35
  img = np.array(img)
36
 
37
- # RGBA → RGB
38
  if img.shape[-1] == 4:
39
  img = cv2.cvtColor(img, cv2.COLOR_RGBA2RGB)
40
 
 
5
  import keras
6
  from huggingface_hub import hf_hub_download
7
 
 
8
  labels = ["angry", "disgust", "fear", "happy", "neutral", "sad", "surprise"]
9
 
10
  st.set_page_config(page_title="Emotion AI", page_icon="🧠", layout="centered")
11
 
12
  st.markdown("""
13
  <h1 style='text-align:center;'>🧠 Emotion Recognition AI</h1>
14
+ <p style='text-align:center;'>Upload a face image to detect emotion</p>
15
  """, unsafe_allow_html=True)
16
 
 
17
  @st.cache_resource
18
  def load_model():
19
  model_path = hf_hub_download(
20
  repo_id="fdfddfdsaassd/vgg19-emotion-recognition-ckplus-rafdb",
21
+ filename="emotion_vgg19_model.h5"
22
  )
23
  return keras.models.load_model(model_path, compile=False)
24
 
 
32
 
33
  img = np.array(img)
34
 
 
35
  if img.shape[-1] == 4:
36
  img = cv2.cvtColor(img, cv2.COLOR_RGBA2RGB)
37