Chinnatip Taemkaeo commited on
Commit
7dc603d
·
1 Parent(s): cda2784

add ffmpeg

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -5
  2. interface.py +9 -1
Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
  # ใช้ Debian base image
2
  FROM debian:bookworm-slim
3
 
4
- # ติดตั้ง Python และ pip
5
- RUN apt update && apt install -y python3 python3-pip python3-venv
6
 
7
  # ตั้งค่า Hugging Face Model Cache
8
  ENV HF_HOME=/app/cache
@@ -31,6 +31,5 @@ COPY . .
31
  # เปิดพอร์ต 7860 สำหรับ Gradio
32
  EXPOSE 7860
33
 
34
- # ✅ ใช้ Virtual Environment
35
- CMD ["/app/venv/bin/python", "-u", "interface.py"]
36
-
 
1
  # ใช้ Debian base image
2
  FROM debian:bookworm-slim
3
 
4
+ # ติดตั้ง Python, pip และ ffmpeg
5
+ RUN apt update && apt install -y python3 python3-pip python3-venv ffmpeg
6
 
7
  # ตั้งค่า Hugging Face Model Cache
8
  ENV HF_HOME=/app/cache
 
31
  # เปิดพอร์ต 7860 สำหรับ Gradio
32
  EXPOSE 7860
33
 
34
+ # ✅ ใช้ Virtual Environment และตรวจสอบ ffmpeg
35
+ CMD ["sh", "-c", "which ffmpeg && /app/venv/bin/python -u interface.py"]
 
interface.py CHANGED
@@ -1,7 +1,15 @@
1
  import os
 
2
  import gradio as gr
3
  from transformers import pipeline
4
 
 
 
 
 
 
 
 
5
  # ✅ Debug Log: ตรวจสอบว่าโค้ดถึงขั้นตอนไหน
6
  print("🚀 Application Starting...")
7
 
@@ -35,7 +43,7 @@ iface = gr.Interface(
35
  inputs=gr.Audio(type="filepath"),
36
  outputs="json",
37
  title="Baby Cry Detector",
38
- description="Upload an audio file to classify whether it contains a baby's cry.",
39
  flagging_dir="/app/flagged"
40
  )
41
 
 
1
  import os
2
+ import shutil
3
  import gradio as gr
4
  from transformers import pipeline
5
 
6
+ # ✅ ตรวจสอบว่า ffmpeg พร้อมใช้งานหรือไม่
7
+ ffmpeg_path = shutil.which("ffmpeg")
8
+ if ffmpeg_path:
9
+ print(f"✅ ffmpeg found at: {ffmpeg_path}")
10
+ else:
11
+ print("❌ ffmpeg NOT found! Audio processing will fail.")
12
+
13
  # ✅ Debug Log: ตรวจสอบว่าโค้ดถึงขั้นตอนไหน
14
  print("🚀 Application Starting...")
15
 
 
43
  inputs=gr.Audio(type="filepath"),
44
  outputs="json",
45
  title="Baby Cry Detector",
46
+ description="Upload an audio file or record audio to classify whether it contains a baby's cry.",
47
  flagging_dir="/app/flagged"
48
  )
49