Spaces:
Running
Running
Commit
·
7803eb5
1
Parent(s):
6b9b193
优化spaces兼容
Browse files
README.md
CHANGED
|
@@ -4,7 +4,6 @@ emoji: 📊
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
-
python_version: 3.12
|
| 8 |
sdk_version: 5.30.0
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
|
|
|
| 7 |
sdk_version: 5.30.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
environment.yaml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: podcast_transcriber_env
|
| 2 |
+
|
| 3 |
+
channels:
|
| 4 |
+
- defaults
|
| 5 |
+
dependencies:
|
| 6 |
+
- python=3.10.13
|
| 7 |
+
- pip
|
| 8 |
+
- packaging
|
requirements.txt
CHANGED
|
@@ -2,12 +2,13 @@ pydub>=0.25.1
|
|
| 2 |
numpy>=2.2.5
|
| 3 |
pyannote.audio>=3.3.2
|
| 4 |
transformers>=4.51.3
|
| 5 |
-
torch
|
| 6 |
-
torchaudio
|
| 7 |
soundfile>=0.13.1
|
| 8 |
feedparser>=6.0.11
|
| 9 |
requests>=2.32.3
|
| 10 |
gradio>=5.30.0
|
|
|
|
| 11 |
|
| 12 |
# 可选依赖 - whisper.cpp 绑定
|
| 13 |
pywhispercpp>=1.3.0
|
|
@@ -17,5 +18,5 @@ accelerate>=1.6.0
|
|
| 17 |
# MLX特定依赖 - 仅适用于Apple Silicon Mac
|
| 18 |
# mlx>=0.25.2
|
| 19 |
# mlx-lm>=0.24.0
|
| 20 |
-
# parakeet-mlx
|
| 21 |
-
# mlx-whisper
|
|
|
|
| 2 |
numpy>=2.2.5
|
| 3 |
pyannote.audio>=3.3.2
|
| 4 |
transformers>=4.51.3
|
| 5 |
+
torch==2.5.1
|
| 6 |
+
torchaudio==2.5.1
|
| 7 |
soundfile>=0.13.1
|
| 8 |
feedparser>=6.0.11
|
| 9 |
requests>=2.32.3
|
| 10 |
gradio>=5.30.0
|
| 11 |
+
spaces>=0.36.0
|
| 12 |
|
| 13 |
# 可选依赖 - whisper.cpp 绑定
|
| 14 |
pywhispercpp>=1.3.0
|
|
|
|
| 18 |
# MLX特定依赖 - 仅适用于Apple Silicon Mac
|
| 19 |
# mlx>=0.25.2
|
| 20 |
# mlx-lm>=0.24.0
|
| 21 |
+
# parakeet-mlx>=0.2.6
|
| 22 |
+
# mlx-whisper>=0.4.2
|
src/podcast_transcribe/asr/asr_router.py
CHANGED
|
@@ -6,6 +6,7 @@ ASR模型调用路由器
|
|
| 6 |
import logging
|
| 7 |
from typing import Dict, Any, Optional, Callable
|
| 8 |
from pydub import AudioSegment
|
|
|
|
| 9 |
from .asr_base import TranscriptionResult
|
| 10 |
from . import asr_parakeet_mlx
|
| 11 |
from . import asr_distil_whisper_mlx
|
|
@@ -195,7 +196,7 @@ class ASRRouter:
|
|
| 195 |
# 创建全局路由器实例
|
| 196 |
_router = ASRRouter()
|
| 197 |
|
| 198 |
-
|
| 199 |
def transcribe_audio(
|
| 200 |
audio_segment: AudioSegment,
|
| 201 |
provider: str = "distil_whisper_transformers",
|
|
|
|
| 6 |
import logging
|
| 7 |
from typing import Dict, Any, Optional, Callable
|
| 8 |
from pydub import AudioSegment
|
| 9 |
+
import spaces
|
| 10 |
from .asr_base import TranscriptionResult
|
| 11 |
from . import asr_parakeet_mlx
|
| 12 |
from . import asr_distil_whisper_mlx
|
|
|
|
| 196 |
# 创建全局路由器实例
|
| 197 |
_router = ASRRouter()
|
| 198 |
|
| 199 |
+
@spaces.GPU(duration=180)
|
| 200 |
def transcribe_audio(
|
| 201 |
audio_segment: AudioSegment,
|
| 202 |
provider: str = "distil_whisper_transformers",
|
src/podcast_transcribe/diarization/diarizer_router.py
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
import logging
|
| 7 |
from typing import Dict, Any, Optional, Callable
|
| 8 |
from pydub import AudioSegment
|
|
|
|
| 9 |
from ..schemas import DiarizationResult
|
| 10 |
from . import diarization_pyannote_mlx
|
| 11 |
from . import diarization_pyannote_transformers
|
|
@@ -185,7 +186,7 @@ class DiarizerRouter:
|
|
| 185 |
# 创建全局路由器实例
|
| 186 |
_router = DiarizerRouter()
|
| 187 |
|
| 188 |
-
|
| 189 |
def diarize_audio(
|
| 190 |
audio_segment: AudioSegment,
|
| 191 |
provider: str = "pyannote_mlx",
|
|
|
|
| 6 |
import logging
|
| 7 |
from typing import Dict, Any, Optional, Callable
|
| 8 |
from pydub import AudioSegment
|
| 9 |
+
import spaces
|
| 10 |
from ..schemas import DiarizationResult
|
| 11 |
from . import diarization_pyannote_mlx
|
| 12 |
from . import diarization_pyannote_transformers
|
|
|
|
| 186 |
# 创建全局路由器实例
|
| 187 |
_router = DiarizerRouter()
|
| 188 |
|
| 189 |
+
@spaces.GPU(duration=180)
|
| 190 |
def diarize_audio(
|
| 191 |
audio_segment: AudioSegment,
|
| 192 |
provider: str = "pyannote_mlx",
|
src/podcast_transcribe/llm/llm_router.py
CHANGED
|
@@ -5,6 +5,8 @@ LLM模型调用路由器
|
|
| 5 |
|
| 6 |
import logging
|
| 7 |
from typing import Dict, Any, Optional, List, Union
|
|
|
|
|
|
|
| 8 |
from .llm_base import BaseChatCompletion
|
| 9 |
from . import llm_gemma_mlx
|
| 10 |
from . import llm_gemma_transfomers
|
|
@@ -367,7 +369,7 @@ class LLMRouter:
|
|
| 367 |
# 创建全局路由器实例
|
| 368 |
_router = LLMRouter()
|
| 369 |
|
| 370 |
-
|
| 371 |
def chat_completion(
|
| 372 |
messages: List[Dict[str, str]],
|
| 373 |
provider: str = "gemma-mlx",
|
|
@@ -461,7 +463,7 @@ def chat_completion(
|
|
| 461 |
**params
|
| 462 |
)
|
| 463 |
|
| 464 |
-
|
| 465 |
def reasoning_completion(
|
| 466 |
messages: List[Dict[str, str]],
|
| 467 |
provider: str = "phi4-transformers",
|
|
|
|
| 5 |
|
| 6 |
import logging
|
| 7 |
from typing import Dict, Any, Optional, List, Union
|
| 8 |
+
|
| 9 |
+
import spaces
|
| 10 |
from .llm_base import BaseChatCompletion
|
| 11 |
from . import llm_gemma_mlx
|
| 12 |
from . import llm_gemma_transfomers
|
|
|
|
| 369 |
# 创建全局路由器实例
|
| 370 |
_router = LLMRouter()
|
| 371 |
|
| 372 |
+
@spaces.GPU(duration=60)
|
| 373 |
def chat_completion(
|
| 374 |
messages: List[Dict[str, str]],
|
| 375 |
provider: str = "gemma-mlx",
|
|
|
|
| 463 |
**params
|
| 464 |
)
|
| 465 |
|
| 466 |
+
@spaces.GPU(duration=60)
|
| 467 |
def reasoning_completion(
|
| 468 |
messages: List[Dict[str, str]],
|
| 469 |
provider: str = "phi4-transformers",
|