make it run
This commit is contained in:
parent
6f4e127d06
commit
7567f1ffe2
2 changed files with 16 additions and 6 deletions
|
@ -9,6 +9,14 @@ use whisper_timestamped to add automatic transcriptions to pan.do/ra
|
||||||
|
|
||||||
add "transcribe" to LOCAL_APPS in local_setttings.py
|
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
|
## configuration
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import shutil
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import time
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
import ox.iso
|
import ox.iso
|
||||||
|
@ -11,9 +12,10 @@ import ox.iso
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from annotation import tasks
|
from annotation import tasks
|
||||||
from item.models import Item
|
|
||||||
from itemlist.models import List
|
|
||||||
from item import utils
|
from item import utils
|
||||||
|
from itemlist.models import List
|
||||||
|
from item.models import Item
|
||||||
|
from user.models import User
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -80,9 +82,9 @@ def extract_subtitles(item, user, layer, translate, gpu=False):
|
||||||
|
|
||||||
|
|
||||||
def main(**kwargs):
|
def main(**kwargs):
|
||||||
queue = List.objects.get(kwargs['queue'])
|
user = User.objects.get(username=kwargs['user'])
|
||||||
done = List.objects.get(kwargs['done'])
|
queue = List.objects.get(user=user, name=kwargs['queue'])
|
||||||
user = User.objects.get(kwargs['user'])
|
done = List.objects.get(user=user, name=kwargs['done'])
|
||||||
layer = kwargs.get("layer")
|
layer = kwargs.get("layer")
|
||||||
translate = kwargs.get("translate")
|
translate = kwargs.get("translate")
|
||||||
if translate:
|
if translate:
|
||||||
|
@ -97,7 +99,7 @@ def main(**kwargs):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
wait = 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")):
|
if extract_subtitles(item, user, layer, translate, kwargs.get("gpu")):
|
||||||
queue.items.remove(item)
|
queue.items.remove(item)
|
||||||
done.items.remove(item)
|
done.items.remove(item)
|
||||||
|
|
Loading…
Reference in a new issue