Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ import json
|
|
11 |
from datetime import datetime
|
12 |
from pathlib import Path
|
13 |
from uuid import uuid4
|
|
|
14 |
|
15 |
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
16 |
|
@@ -35,6 +36,7 @@ scheduler = CommitScheduler(
|
|
35 |
)
|
36 |
|
37 |
@spaces.GPU
|
|
|
38 |
def transcribe_audio(inputs, task):
|
39 |
if inputs is None:
|
40 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
@@ -57,6 +59,7 @@ def download_yt_audio(yt_url, filename):
|
|
57 |
ydl.download([yt_url])
|
58 |
|
59 |
@spaces.GPU
|
|
|
60 |
def yt_transcribe(yt_url, task):
|
61 |
with tempfile.TemporaryDirectory() as tmpdirname:
|
62 |
filepath = os.path.join(tmpdirname, "video.mp4")
|
|
|
11 |
from datetime import datetime
|
12 |
from pathlib import Path
|
13 |
from uuid import uuid4
|
14 |
+
from functools import lru_cache
|
15 |
|
16 |
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
17 |
|
|
|
36 |
)
|
37 |
|
38 |
@spaces.GPU
|
39 |
+
@lru_cache(maxsize=10)
|
40 |
def transcribe_audio(inputs, task):
|
41 |
if inputs is None:
|
42 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
|
|
59 |
ydl.download([yt_url])
|
60 |
|
61 |
@spaces.GPU
|
62 |
+
@lru_cache(maxsize=10)
|
63 |
def yt_transcribe(yt_url, task):
|
64 |
with tempfile.TemporaryDirectory() as tmpdirname:
|
65 |
filepath = os.path.join(tmpdirname, "video.mp4")
|