make it run

This commit is contained in:
j 2024-07-07 15:46:41 +01:00
parent 6f4e127d06
commit 7567f1ffe2
2 changed files with 16 additions and 6 deletions

View file

@ -9,6 +9,14 @@ use whisper_timestamped to add automatic transcriptions to pan.do/ra
add "transcribe" to LOCAL_APPS in local_setttings.py
## install whisper_timestamped
python3 -m venv venv /opt/whisper-timestamped/
/opt/whisper-timestamped/bin/pip install \
torch==1.13.1+cpu \
torchaudio==0.13.1+cpu \
-f https://download.pytorch.org/whl/torch_stable.html
/opt/whisper-timestamped/bin/pip install whisper-timestamped
## configuration

View file

@ -4,6 +4,7 @@ import shutil
import signal
import subprocess
import tempfile
import time
import ox
import ox.iso
@ -11,9 +12,10 @@ import ox.iso
from django.conf import settings
from annotation import tasks
from item.models import Item
from itemlist.models import List
from item import utils
from itemlist.models import List
from item.models import Item
from user.models import User
logger = logging.getLogger(__name__)
@ -80,9 +82,9 @@ def extract_subtitles(item, user, layer, translate, gpu=False):
def main(**kwargs):
queue = List.objects.get(kwargs['queue'])
done = List.objects.get(kwargs['done'])
user = User.objects.get(kwargs['user'])
user = User.objects.get(username=kwargs['user'])
queue = List.objects.get(user=user, name=kwargs['queue'])
done = List.objects.get(user=user, name=kwargs['done'])
layer = kwargs.get("layer")
translate = kwargs.get("translate")
if translate:
@ -97,7 +99,7 @@ def main(**kwargs):
try:
while True:
wait = True
for item in queue.get_items(queue.user):
for item in queue.get_items(queue.user).all():
if extract_subtitles(item, user, layer, translate, kwargs.get("gpu")):
queue.items.remove(item)
done.items.remove(item)