ahmad walidurosyad commited on
Commit
bfe81d6
·
1 Parent(s): cb7d97e

Switch to Gradio SDK with DiariZen git install in requirements.txt

Browse files

- Changed from Docker SDK to Gradio SDK to avoid build complexity
- Added @spaces.GPU decorator for GPU acceleration
- Install DiariZen directly from git in requirements.txt
- Removed Dockerfile (not needed with Gradio SDK)
- Added spaces package for GPU decorator support

Files changed (4) hide show
  1. Dockerfile +0 -55
  2. README.md +3 -3
  3. app.py +3 -1
  4. requirements.txt +7 -2
Dockerfile DELETED
@@ -1,55 +0,0 @@
1
- # Use NVIDIA CUDA base image (comes with CUDA pre-installed)
2
- FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
3
-
4
- # Install Python 3.10 and system dependencies
5
- RUN apt-get update && apt-get install -y \
6
- python3.10 \
7
- python3-pip \
8
- git \
9
- ffmpeg \
10
- && rm -rf /var/lib/apt/lists/*
11
-
12
- # Set Python 3.10 as default
13
- RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
14
- RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
15
-
16
- # Set working directory
17
- WORKDIR /app
18
-
19
- # Install PyTorch (will use pre-installed CUDA from base image)
20
- RUN pip install --no-cache-dir torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121
21
-
22
- # Clone DiariZen repository
23
- RUN git clone https://github.com/BUTSpeechFIT/DiariZen.git /tmp/diarizen
24
-
25
- # Install DiariZen requirements
26
- WORKDIR /tmp/diarizen
27
- RUN pip install --no-cache-dir -r requirements.txt
28
-
29
- # Install DiariZen package
30
- RUN pip install --no-cache-dir -e .
31
-
32
- # Initialize and update git submodules
33
- RUN git submodule init && git submodule update
34
-
35
- # Install bundled pyannote-audio
36
- WORKDIR /tmp/diarizen/pyannote-audio
37
- RUN pip install --no-cache-dir -e .
38
-
39
- # Install Gradio (spaces package not needed for Docker SDK)
40
- WORKDIR /app
41
- RUN pip install --no-cache-dir gradio==4.27.0 huggingface_hub<0.20.0
42
-
43
- # Copy application files
44
- COPY app.py /app/
45
- COPY README.md /app/
46
-
47
- # Expose port 7860
48
- EXPOSE 7860
49
-
50
- # Set up Gradio environment variables
51
- ENV GRADIO_SERVER_NAME="0.0.0.0"
52
- ENV GRADIO_SERVER_PORT=7860
53
-
54
- # Run the application
55
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -3,12 +3,12 @@ title: DiariZen Speaker Diarization
3
  emoji: 🎙️
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: docker
7
- app_port: 7860
 
8
  suggested_hardware: t4-small
9
  pinned: false
10
  license: mit
11
- short_description: High-performance speaker diarization using DiariZen
12
  ---
13
 
14
  # 🎙️ DiariZen Speaker Diarization
 
3
  emoji: 🎙️
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 4.27.0
8
+ app_file: app.py
9
  suggested_hardware: t4-small
10
  pinned: false
11
  license: mit
 
12
  ---
13
 
14
  # 🎙️ DiariZen Speaker Diarization
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import os
3
  import torch
4
  import tempfile
@@ -65,8 +66,9 @@ def save_rttm(annotations, audio_filename):
65
 
66
  return str(rttm_path)
67
 
 
68
  def diarize_audio(audio_file, model_choice):
69
- """Main diarization function - GPU available via Docker container"""
70
  if not DIARIZEN_AVAILABLE:
71
  return "❌ Error: DiariZen not installed. Please install from https://github.com/BUTSpeechFIT/DiariZen", None
72
 
 
1
  import gradio as gr
2
+ import spaces
3
  import os
4
  import torch
5
  import tempfile
 
66
 
67
  return str(rttm_path)
68
 
69
+ @spaces.GPU(duration=120)
70
  def diarize_audio(audio_file, model_choice):
71
+ """Main diarization function with GPU acceleration"""
72
  if not DIARIZEN_AVAILABLE:
73
  return "❌ Error: DiariZen not installed. Please install from https://github.com/BUTSpeechFIT/DiariZen", None
74
 
requirements.txt CHANGED
@@ -1,2 +1,7 @@
1
- # This Space uses a Dockerfile for installation
2
- # See Dockerfile for DiariZen installation steps
 
 
 
 
 
 
1
+ torch==2.1.1
2
+ torchvision==0.16.1
3
+ torchaudio==2.1.1
4
+ gradio==4.27.0
5
+ huggingface_hub<0.20.0
6
+ spaces==0.30.2
7
+ git+https://github.com/BUTSpeechFIT/DiariZen.git