Add ZeroGPU function decorators
Browse files
app.py
CHANGED
|
@@ -12,6 +12,7 @@ from typing import Optional
|
|
| 12 |
|
| 13 |
import gradio as gr
|
| 14 |
import soundfile as sf
|
|
|
|
| 15 |
from huggingface_hub import snapshot_download
|
| 16 |
|
| 17 |
ASR_REPO = os.getenv("ASR_REPO", "Daumee/Qwen3-ASR-0.6B-ONNX-CPU")
|
|
@@ -128,6 +129,7 @@ def health(api_key: str = "") -> str:
|
|
| 128 |
)
|
| 129 |
|
| 130 |
|
|
|
|
| 131 |
def transcribe_b64(
|
| 132 |
api_key: str,
|
| 133 |
audio_base64: str,
|
|
@@ -171,6 +173,7 @@ def transcribe_b64(
|
|
| 171 |
)
|
| 172 |
|
| 173 |
|
|
|
|
| 174 |
def speech_b64(api_key: str, text: str, voice: str = "zf_xiaoxiao", speed: float = 1.0) -> str:
|
| 175 |
check_key(api_key)
|
| 176 |
speed = float(speed)
|
|
|
|
| 12 |
|
| 13 |
import gradio as gr
|
| 14 |
import soundfile as sf
|
| 15 |
+
import spaces
|
| 16 |
from huggingface_hub import snapshot_download
|
| 17 |
|
| 18 |
ASR_REPO = os.getenv("ASR_REPO", "Daumee/Qwen3-ASR-0.6B-ONNX-CPU")
|
|
|
|
| 129 |
)
|
| 130 |
|
| 131 |
|
| 132 |
+
@spaces.GPU(duration=300)
|
| 133 |
def transcribe_b64(
|
| 134 |
api_key: str,
|
| 135 |
audio_base64: str,
|
|
|
|
| 173 |
)
|
| 174 |
|
| 175 |
|
| 176 |
+
@spaces.GPU(duration=300)
|
| 177 |
def speech_b64(api_key: str, text: str, voice: str = "zf_xiaoxiao", speed: float = 1.0) -> str:
|
| 178 |
check_key(api_key)
|
| 179 |
speed = float(speed)
|