Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod changes to develop #964

Merged
merged 153 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
c2510d7
fixed issues with alignment api
SenorLancelot May 2, 2024
1ceea12
Merge pull request #870 from AI4Bharat/develop
aparna-aa Sep 3, 2024
688ddc3
Merge pull request #872 from AI4Bharat/develop
aparna-aa Sep 3, 2024
6d2b23a
Merge pull request #873 from AI4Bharat/reopen2
aparna-aa Sep 3, 2024
5340fb9
Merge pull request #875 from AI4Bharat/reopen2
aparna-aa Sep 3, 2024
c492d59
Merge pull request #879 from AI4Bharat/reopen2
aparna-aa Sep 6, 2024
f173e3f
Merge pull request #881 from AI4Bharat/reopen2
aparna-aa Sep 6, 2024
6455607
moving openai engine to env variables
kartikvirendrar Sep 10, 2024
55b6ca5
Merge pull request #884 from AI4Bharat/reopen2
ishvindersethi22 Sep 10, 2024
18d3716
add status field to admin panel display for voiceover
kartikvirendrar Sep 10, 2024
a9a326d
add status field to admin panel display for voiceover
kartikvirendrar Sep 10, 2024
2e3b3c4
Merge pull request #885 from AI4Bharat/reopen2
aparna-aa Sep 10, 2024
6e1c2db
add status field to admin panel display for trnaslation and transcrip…
kartikvirendrar Sep 10, 2024
c94da1f
Merge pull request #886 from AI4Bharat/reopen2
aparna-aa Sep 10, 2024
0e7d73a
Merge pull request #711 from AI4Bharat/align-api-fix
aparna-aa Sep 10, 2024
521e16b
fix support for upload of google drive video
kartikvirendrar Sep 10, 2024
73f4e6f
Merge pull request #890 from AI4Bharat/googleDrive
aparna-aa Sep 10, 2024
ccb6826
make emails lowercase while signup and login
kartikvirendrar Sep 12, 2024
cb61e0d
Merge pull request #892 from AI4Bharat/googleDrive
aparna-aa Sep 12, 2024
4111d3f
added endpoints for set/get transcription translation and voiceover t…
kartikvirendrar Sep 12, 2024
f8238c4
Merge pull request #893 from AI4Bharat/googleDrive
aparna-aa Sep 12, 2024
d06c9a1
changes for password reset email link
kartikvirendrar Sep 12, 2024
c4f5a29
Merge pull request #894 from AI4Bharat/googleDrive
aparna-aa Sep 12, 2024
4d3de16
add project title to django admin view
kartikvirendrar Sep 13, 2024
34dc0bf
fixed auto save failing when page changes for transcription task
kartikvirendrar Sep 16, 2024
811b3be
Merge pull request #895 from AI4Bharat/googleDrive
aparna-aa Sep 16, 2024
3822898
add error message for 0 duration
kartikvirendrar Sep 18, 2024
c5b7bf7
Merge pull request #897 from AI4Bharat/googleDrive
aparna-aa Sep 18, 2024
252e180
fix transcription taask complete bug
kartikvirendrar Sep 18, 2024
cc3af45
fix transcription taask complete bug
kartikvirendrar Sep 18, 2024
a39fc41
Merge pull request #898 from AI4Bharat/googleDrive
aparna-aa Sep 18, 2024
32bcca8
minor fix for submitting transcription
kartikvirendrar Sep 18, 2024
2a0915b
Merge pull request #899 from AI4Bharat/googleDrive
aparna-aa Sep 18, 2024
0252045
change duration 0 error message to appear for duration < 0.1
kartikvirendrar Sep 19, 2024
ab6da96
fix minor bug in paraphrasing
kartikvirendrar Sep 20, 2024
aba38b6
Merge pull request #904 from AI4Bharat/googleDrive
aparna-aa Sep 20, 2024
a055285
fix for bookmark segment
kartikvirendrar Sep 21, 2024
3b61c59
Merge pull request #906 from AI4Bharat/googleDrive
aparna-aa Sep 21, 2024
e15c2d0
add endpoint to reopen transcription task
kartikvirendrar Sep 24, 2024
79fbbfb
Merge pull request #907 from AI4Bharat/googleDrive
aparna-aa Sep 24, 2024
db894ff
fixed minor bug in completing transcription task
kartikvirendrar Sep 24, 2024
ea82c61
fixed minor bug in completing transcription task
kartikvirendrar Sep 24, 2024
23895cb
Merge pull request #908 from AI4Bharat/googleDrive
aparna-aa Sep 24, 2024
f4b0671
added regenerate for VOTR
kartikvirendrar Oct 2, 2024
6abac46
Merge pull request #912 from AI4Bharat/googleDrive
aparna-aa Oct 2, 2024
6bb0461
fixes for 0 duration error
kartikvirendrar Oct 4, 2024
fdf31d6
Merge branch 'master' into googleDrive
kartikvirendrar Oct 4, 2024
403fba3
Merge pull request #913 from AI4Bharat/googleDrive
aparna-aa Oct 4, 2024
11d8a07
add Nepali to transcription languages list
kartikvirendrar Oct 7, 2024
8f66376
Merge pull request #914 from AI4Bharat/googleDrive
aparna-aa Oct 7, 2024
9896d0b
added votr active task export transcript and translation
kartikvirendrar Oct 7, 2024
751c3d7
minor fix for bulk video upload
kartikvirendrar Oct 8, 2024
f6606be
Merge pull request #915 from AI4Bharat/exportVOTR
aparna-aa Oct 8, 2024
f6778b1
minor fix for 0 duration error
kartikvirendrar Oct 8, 2024
0a0df0b
Merge pull request #916 from AI4Bharat/exportVOTR
aparna-aa Oct 8, 2024
97a7719
minor changes for xlit endpoint
kartikvirendrar Oct 10, 2024
24ac72e
minor changes for xlit endpoint
kartikvirendrar Oct 10, 2024
94c5dcf
Merge pull request #917 from AI4Bharat/exportVOTR
ishvindersethi22 Oct 10, 2024
f8f450a
add asr service id for nepali language
kartikvirendrar Oct 11, 2024
76c604c
Merge pull request #918 from AI4Bharat/exportVOTR
ishvindersethi22 Oct 11, 2024
1f1849d
minor changes in task_queues api
kartikvirendrar Oct 15, 2024
b4b8717
Merge pull request #919 from AI4Bharat/exportVOTR
aparna-aa Oct 15, 2024
cacf503
minor changes in task_queues api
kartikvirendrar Oct 15, 2024
dc1ab07
Merge pull request #920 from AI4Bharat/exportVOTR
aparna-aa Oct 15, 2024
bcd9d81
minor fixes in task queue status
kartikvirendrar Oct 15, 2024
7e8fb25
Merge pull request #921 from AI4Bharat/exportVOTR
aparna-aa Oct 15, 2024
034ec96
Update docker-compose.yml
ishvindersethi22 Oct 16, 2024
c276939
Merge pull request #922 from AI4Bharat/Increase-concurrency-ASR-celer…
aparna-aa Oct 16, 2024
c211d4a
Revert "Increase concurrency in ASR celery worker"
ishvindersethi22 Oct 18, 2024
78e6199
Merge pull request #923 from AI4Bharat/revert-922-Increase-concurrenc…
ishvindersethi22 Oct 18, 2024
596424a
changes for csv bulk regenerate failed VOTR tasks
kartikvirendrar Oct 18, 2024
837adb3
Merge pull request #924 from AI4Bharat/exportVOTR
aparna-aa Oct 22, 2024
1ba1d2e
add fast_audio flag
kartikvirendrar Oct 28, 2024
b0edcc0
add fast_audio flag
kartikvirendrar Oct 28, 2024
9279b09
Merge pull request #925 from AI4Bharat/exportVOTR
aparna-aa Oct 28, 2024
f017a91
Revert "Revert "Increase concurrency in ASR celery worker""
ishvindersethi22 Oct 29, 2024
b51a814
Merge pull request #926 from AI4Bharat/revert-923-revert-922-Increase…
kartikvirendrar Oct 29, 2024
7f1a68c
changes for fast_audio flag
kartikvirendrar Oct 30, 2024
35ae670
Merge pull request #927 from AI4Bharat/exportVOTR
aparna-aa Oct 30, 2024
44af236
fixed minor bug in complete transcription task
kartikvirendrar Oct 30, 2024
79dd826
Merge pull request #928 from AI4Bharat/exportVOTR
aparna-aa Oct 30, 2024
d0565d9
minor fix for fast audio flag in auto save call
kartikvirendrar Nov 1, 2024
f1c8894
Merge pull request #929 from AI4Bharat/exportVOTR
aparna-aa Nov 4, 2024
fb9b84b
fix zero division error
kartikvirendrar Nov 4, 2024
dc3e9d6
Merge pull request #930 from AI4Bharat/exportVOTR
kartikvirendrar Nov 4, 2024
9fcf932
fix zero division error
kartikvirendrar Nov 4, 2024
ab8a49b
Merge pull request #931 from AI4Bharat/exportVOTR
kartikvirendrar Nov 4, 2024
c6603bf
fix zero division error
kartikvirendrar Nov 4, 2024
a597de7
add correct error message for regenerating voiceover for 0 duration s…
kartikvirendrar Nov 11, 2024
e7f682e
Merge pull request #932 from AI4Bharat/exportVOTR
kartikvirendrar Nov 11, 2024
8afb7f8
Merge pull request #933 from AI4Bharat/minorchange01
aparna-aa Nov 11, 2024
4d4a045
fix a bug in VOTR task completion
kartikvirendrar Nov 12, 2024
7a0a6b0
Merge pull request #934 from AI4Bharat/minorchange01
aparna-aa Nov 12, 2024
6f7a9d3
add send users active tasks email
kartikvirendrar Nov 12, 2024
1805090
add send users active tasks email
kartikvirendrar Nov 12, 2024
9bd0409
add send users active tasks email
kartikvirendrar Nov 13, 2024
59f0da5
add send users active tasks email
kartikvirendrar Nov 13, 2024
0cef38c
add send users active tasks email
kartikvirendrar Nov 13, 2024
5d4dc36
add send users active tasks email
kartikvirendrar Nov 14, 2024
eff6b35
Merge pull request #935 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
cf1377a
add send users active tasks email
kartikvirendrar Nov 14, 2024
a9159d1
Merge pull request #937 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
affbaa3
add send users active tasks email
kartikvirendrar Nov 14, 2024
089a51e
Merge pull request #938 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
8615d43
add send users active tasks email
kartikvirendrar Nov 14, 2024
cc27dc8
add send users active tasks email
kartikvirendrar Nov 14, 2024
fbb12a8
Merge pull request #939 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
b8f2a2c
add send users active tasks email
kartikvirendrar Nov 14, 2024
20dd3b5
Merge pull request #940 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
2c69146
add send users active tasks email
kartikvirendrar Nov 14, 2024
0072e79
Merge pull request #941 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
533b5ef
add send users active tasks email
kartikvirendrar Nov 14, 2024
957b10a
add send users active tasks email
kartikvirendrar Nov 14, 2024
cc58b7e
Merge pull request #942 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
6b54cee
add send users active tasks email
kartikvirendrar Nov 14, 2024
2888cb7
Merge pull request #943 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
5938995
add send users active tasks email
kartikvirendrar Nov 14, 2024
ef7f75a
add send users active tasks email
kartikvirendrar Nov 14, 2024
efba277
add send users active tasks email
kartikvirendrar Nov 14, 2024
07e2beb
Merge pull request #944 from AI4Bharat/minorchange01
kartikvirendrar Nov 14, 2024
64eb9bc
Merge pull request #945 from AI4Bharat/minorchange03
kartikvirendrar Nov 14, 2024
3c256d0
Merge pull request #946 from AI4Bharat/minorchange04
kartikvirendrar Nov 14, 2024
95dd3d4
Remove send active tasks email
kartikvirendrar Nov 14, 2024
7fed359
Merge pull request #947 from AI4Bharat/minorchange04
kartikvirendrar Nov 14, 2024
42b6909
handle an edge case of negative duration
kartikvirendrar Nov 20, 2024
0bc1e8e
Merge pull request #948 from AI4Bharat/minorchange05
aparna-aa Nov 20, 2024
43bc297
minor bug fix for regenerate VOTR tasks using bulk_csv_upload
kartikvirendrar Nov 22, 2024
bdbd8b1
Merge pull request #949 from AI4Bharat/minorchange05
aparna-aa Nov 22, 2024
b3cc893
add task id and language in logging info
kartikvirendrar Dec 11, 2024
112d48e
Merge pull request #951 from AI4Bharat/minorchange-01
aparna-aa Dec 11, 2024
64b4408
minor change in inspect queue
kartikvirendrar Dec 12, 2024
a9e3e90
Merge pull request #952 from AI4Bharat/minorchange-01
kartikvirendrar Dec 12, 2024
034278a
minor changes for azure blob videos
kartikvirendrar Dec 13, 2024
62d6fe1
Merge pull request #953 from AI4Bharat/minorchange-01
aparna-aa Dec 13, 2024
3da7126
minor bug fix in celery inspection
kartikvirendrar Dec 13, 2024
cab4161
Merge pull request #954 from AI4Bharat/minorchange-01
aparna-aa Dec 13, 2024
19993e4
minor changes for azure blob video url
kartikvirendrar Dec 18, 2024
51437eb
Merge pull request #955 from AI4Bharat/minorchange-01
kartikvirendrar Dec 18, 2024
9c8e371
added changes for export filename changes
kartikvirendrar Dec 18, 2024
b6e0241
Merge pull request #956 from AI4Bharat/minorchange-01
kartikvirendrar Dec 18, 2024
dad65b3
minor change for azure blob video
kartikvirendrar Dec 18, 2024
c2fccaf
Merge pull request #957 from AI4Bharat/minorchange-01
kartikvirendrar Dec 18, 2024
f2a657d
error logging for video api
kartikvirendrar Dec 18, 2024
0c6c1fe
Merge pull request #958 from AI4Bharat/minorchange-01
kartikvirendrar Dec 18, 2024
9c61c5c
changes for azure blob video
kartikvirendrar Dec 18, 2024
718a773
Merge pull request #959 from AI4Bharat/minorchange-01
kartikvirendrar Dec 18, 2024
62e7af1
changes for bulk regenerate VOTR
kartikvirendrar Dec 19, 2024
de64bb0
Merge pull request #960 from AI4Bharat/minorchange-01
kartikvirendrar Dec 19, 2024
c6a09a5
Revert "added changes for export filename changes"
kartikvirendrar Dec 19, 2024
d02ba61
Merge pull request #961 from AI4Bharat/revert-956-minorchange-01
kartikvirendrar Dec 19, 2024
bea0f08
changes for bulk regenerate failed VOTR tasks
kartikvirendrar Dec 24, 2024
891b826
Merge pull request #962 from AI4Bharat/minorchange-05
aparna-aa Dec 24, 2024
7fd44ce
Merge branch 'develop' into master
kartikvirendrar Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ai-services/align-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ tensorboardX
rich==12.6.0
srt==3.5.2
Cython==0.29.32
urduhack==1.1.1
fastapi['all']
urduhack
fastapi
indic-nlp-library
11 changes: 8 additions & 3 deletions ai-services/align-api/src/wav2vec2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dataclasses import dataclass
from rich.console import Console
from rich.traceback import install

import os
install()
console = Console()

Expand Down Expand Up @@ -35,8 +35,13 @@ def length(self):

class Wav2vec2:
def __init__(self, model_path, language_code, mode, device):
self.asr_path = glob(model_path + "/" + language_code + "/*.pt")[0]
self.dict_path = glob(model_path + "/" + language_code + "/*.txt")[0]
current_dir = os.path.dirname(os.path.abspath(__file__))
two_levels_up = os.path.abspath(os.path.join(current_dir, "../../"))
model_loc = os.path.join(two_levels_up, os.path.join(model_path, language_code))

self.asr_path = glob(os.path.join( model_loc ,"*.pt"))[0]
self.dict_path = glob(os.path.join(model_loc, "*.txt"))[0]

self.device = device
self.encoder = self.load_model_encoder()
self.labels = self.get_labels()
Expand Down
3 changes: 2 additions & 1 deletion backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

DOMAIN = os.getenv("DOMAIN")
SITE_NAME = os.getenv("DOMAIN")
PROTOCOL = "https"
DEFAULT_HTTP_PROTOCOL = 'https'

DJOSER = {
"PASSWORD_RESET_CONFIRM_URL": "forget-password/confirm/{uid}/{token}",
Expand Down Expand Up @@ -127,6 +127,7 @@

CSRF_TRUSTED_ORIGINS = [
"http://localhost:*", # for localhost (Developlemt)
"https://*.ai4bharat.org",
]
CUSTOM_CSRF_TRUSTED_ORIGINS = os.getenv("CORS_TRUSTED_ORIGINS", "")
if CUSTOM_CSRF_TRUSTED_ORIGINS:
Expand Down
2 changes: 1 addition & 1 deletion backend/backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_schema(self, request=None, public=False):
path("voiceover/", include("voiceover.urls")),
path("youtube/", include("youtube.urls")),
path(
"api/generic/transliteration/<str:target_language>/<str:data>/",
"xlit-api/generic/transliteration/<str:target_language>/<str:data>",
TransliterationAPIView.as_view(),
name="transliteration-api",
),
Expand Down
1 change: 1 addition & 0 deletions backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
english_asr_url = os.getenv("ENGLISH_ASR_API_URL")
indic_asr_url = os.getenv("INDIC_ASR_API_URL")
service_id_hindi = os.getenv("SERVICE_ID_HINDI")
service_id_nepali = os.getenv("SERVICE_ID_NEPALI")
service_id_indo_aryan = os.getenv("SERVICE_ID_INDO_ARYAN")
service_id_dravidian = os.getenv("SERVICE_ID_DRAVIDIAN")
misc_tts_url = os.getenv("MISC_TTS_API_URL")
Expand Down
3 changes: 3 additions & 0 deletions backend/organization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
task["updated_at"]
).replace(tzinfo=None):
buttons["Reopen"] = False
if "TRANSLATION_VOICEOVER" in task["task_type"]:
if task["status"] in ["SELECTED_SOURCE", "FAILED"] and task["is_active"] is False:
buttons["Regenerate"] = True
if task["status"] == "POST_PROCESS":
buttons["Update"] = True
if task["status"] == "FAILED":
Expand Down
1 change: 1 addition & 0 deletions backend/project/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ProjectAdmin(admin.ModelAdmin):

list_display = (
"id",
"title",
"organization_id",
"default_task_types",
"default_target_languages",
Expand Down
3 changes: 3 additions & 0 deletions backend/project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,9 @@ def list_project_tasks(self, request, pk=None, *args, **kwargs):
data["updated_at"]
).replace(tzinfo=None):
buttons["Reopen"] = False
if "TRANSLATION_VOICEOVER" in data["task_type"]:
if data["status"] in ["SELECTED_SOURCE", "FAILED"] and data["is_active"] is False:
buttons["Regenerate"] = True
if data["status"] == "POST_PROCESS":
buttons["Update"] = True
if data["status"] == "FAILED":
Expand Down
117 changes: 58 additions & 59 deletions backend/task/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ def celery_nmt_tts_call(task_id):
task_obj.status = "FAILED"
task_obj.is_active = False
task_obj.save()
logging.info("Generating translation payload failed for %s", str(task_id))
return
else:
if (
type(translation_obj.payload) == dict
Expand All @@ -308,69 +310,66 @@ def celery_nmt_tts_call(task_id):
task_obj.status = "SELECTED_SOURCE"
# task_obj.is_active = True
task_obj.save()
tts_payload = process_translation_payload(
translation_obj, task_obj.target_language
)
if type(tts_payload) == dict and "message" in tts_payload.keys():
message = tts_payload["message"]
logging.info("Error from TTS API")
voice_over_task.status = "FAILED"
voice_over_task.save()
# set_fail_for_translation_task(task)
return message

(
tts_input,
target_language,
translation,
translation_id,
empty_sentences,
) = tts_payload
tts_payload = process_translation_payload(
translation_obj, task_obj.target_language
)
if type(tts_payload) == dict and "message" in tts_payload.keys():
message = tts_payload["message"]
logging.info("Error from TTS API")
voice_over_task.status = "FAILED"
voice_over_task.save()
# set_fail_for_translation_task(task)
return message

generate_audio = task_obj.video.project_id.pre_generate_audio
tts_payload = generate_tts_output(
tts_input,
target_language,
translation,
translation_obj,
empty_sentences,
generate_audio,
)
payloads = tts_payload
(
tts_input,
target_language,
translation,
translation_id,
empty_sentences,
) = tts_payload

existing_voiceover = VoiceOver.objects.filter(task=task_obj).first()
generate_audio = task_obj.video.project_id.pre_generate_audio
tts_payload = generate_tts_output(
tts_input,
target_language,
translation,
translation_obj,
empty_sentences,
generate_audio,
)
payloads = tts_payload

print("Fetched voiceover", existing_voiceover)
existing_voiceover = VoiceOver.objects.filter(task=task_obj).first()

if existing_voiceover == None:
voiceover_obj = VoiceOver(
video=task_obj.video,
user=task_obj.user,
translation=translation_obj,
payload=tts_payload,
target_language=task_obj.target_language,
task=task_obj,
voice_over_type="MACHINE_GENERATED",
status="VOICEOVER_SELECT_SOURCE",
)
voiceover_obj.save()
else:
existing_voiceover.payload = tts_payload
existing_voiceover.translation = translation_obj
existing_voiceover.save()
task_obj.is_active = True
task_obj.status = "SELECTED_SOURCE"
task_obj.save()
logging.info("Payload generated for TTS API for %s", str(task_id))
if "message" in tts_payload:
task_obj.is_active = False
task_obj.status = "FAILED"
task_obj.save()
try:
send_mail_to_user(task_obj)
except:
logging.info("Error in sending mail")
print("Fetched voiceover", existing_voiceover)

# send_mail_to_user(task_obj)
if existing_voiceover == None:
voiceover_obj = VoiceOver(
video=task_obj.video,
user=task_obj.user,
translation=translation_obj,
payload=tts_payload,
target_language=task_obj.target_language,
task=task_obj,
voice_over_type="MACHINE_GENERATED",
status="VOICEOVER_SELECT_SOURCE",
)
voiceover_obj.save()
else:
logging.info("Translation already exists")
existing_voiceover.payload = tts_payload
existing_voiceover.translation = translation_obj
existing_voiceover.save()
task_obj.is_active = True
task_obj.status = "SELECTED_SOURCE"
task_obj.save()
logging.info("Payload generated for TTS API for %s", str(task_id))
if "message" in tts_payload:
task_obj.is_active = False
task_obj.status = "FAILED"
task_obj.save()
try:
send_mail_to_user(task_obj)
except:
logging.info("Error in sending mail")
66 changes: 34 additions & 32 deletions backend/task/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
from rest_framework.decorators import parser_classes
from rest_framework.parsers import MultiPartParser, FormParser
import regex

from translation.views import regenerate_translation_voiceover

def get_export_translation(request, task_id, export_type):
new_request = HttpRequest()
Expand Down Expand Up @@ -3193,6 +3193,15 @@ def inspect_queue(self, request):
)
elif elem["name"] == "task.tasks.celery_nmt_call":
task_obj["task_id"] = eval(elem["kwargs"])["task_id"]
elif elem["name"] == "task.tasks.celery_nmt_tts_call":
try:
task_obj["task_id"] = eval(elem["kwargs"])["task_id"]
except:
task_obj["task_id"] = eval(elem["args"].split(",")[0].split("(")[1])
elif elem["name"] == "voiceover.tasks.celery_integration":
task_obj["task_id"] = eval(elem["args"].split(",")[2])
elif elem["name"] == "voiceover.tasks.export_voiceover_async":
task_obj["task_id"] = eval(elem["args"].split(",")[0].split("(")[1])
else:
task_obj["task_id"] = ""

Expand Down Expand Up @@ -3229,19 +3238,17 @@ def inspect_queue(self, request):
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
)
else:
if queue == "nmt":
if queue == "nmt" or queue == "nmt_tts":
queue_type = "celery@nmt_worker"
elif queue == "tts":
queue_type = "celery@asr_tts_worker"
else:
queue_type = "celery@asr_tts_worker"

try:
task_list = []
status_list = []
url = f"{flower_url}/api/tasks"
params = {
"state": "STARTED",
"sort_by": "received",
"sort_by": "-received",
"workername": queue_type,
}
if flower_username and flower_password:
Expand All @@ -3255,42 +3262,27 @@ def inspect_queue(self, request):
for elem in task_data:
if queue == "asr" and elem["name"] == "task.tasks.celery_asr_call":
task_list.append(eval(elem["kwargs"])["task_id"])
status_list.append(elem["state"])
elif (
queue == "tts" and elem["name"] == "task.tasks.celery_tts_call"
):
# task_list.append(eval(elem["kwargs"])["task_id"])
task_list.append(eval(elem["args"].split(",")[0].split("(")[1]))
status_list.append(elem["state"])
elif (
queue == "nmt" and elem["name"] == "task.tasks.celery_nmt_call"
):
task_list.append(eval(elem["kwargs"])["task_id"])
else:
pass
params = {
"state": "RECEIVED",
"sort_by": "received",
"workername": queue_type,
}
if flower_username and flower_password:
res = requests.get(
url, params=params, auth=(flower_username, flower_password)
)
else:
res = requests.get(url, params=params)
data = res.json()
task_data = list(data.values())
for elem in task_data:
if queue == "asr" and elem["name"] == "task.tasks.celery_asr_call":
task_list.append(eval(elem["kwargs"])["task_id"])
elif (
queue == "tts" and elem["name"] == "task.tasks.celery_tts_call"
):
# task_list.append(eval(elem["kwargs"])["task_id"])
task_list.append(eval(elem["args"].split(",")[0].split("(")[1]))
status_list.append(elem["state"])
elif (
queue == "nmt" and elem["name"] == "task.tasks.celery_nmt_call"
queue == "nmt_tts" and elem["name"] == "task.tasks.celery_nmt_tts_call"
):
task_list.append(eval(elem["kwargs"])["task_id"])
try:
task_list.append(eval(elem["kwargs"])["task_id"])
status_list.append(elem["state"])
except:
task_list.append(eval(elem["args"].split(",")[0].split("(")[1]))
status_list.append(elem["state"])
else:
pass
if task_list:
Expand All @@ -3314,8 +3306,12 @@ def inspect_queue(self, request):
"video_duration": str(elem["video__duration"]),
}
i = task_list.index(elem["id"])
task_dict["status"] = status_list[i]
task_list[i] = task_dict

for i in task_list:
if type(i) == int:
j = task_list.index(i)
task_list[j] = {"task_id": i, "status": "Not Found"}
return Response(
{"message": "successful", "data": task_list},
status=status.HTTP_200_OK,
Expand Down Expand Up @@ -3392,6 +3388,12 @@ def regenerate_response(self, request, pk, *args, **kwargs):
elif task.task_type == "VOICEOVER_EDIT":
celery_tts_call.delay(task_id=task.id)
api = "TTS"
elif task.task_type == "TRANSLATION_VOICEOVER_EDIT":
if regenerate_translation_voiceover(task.id) is False:
return Response(
{"message": "Transcription task is not complete yet"}, status=status.HTTP_400_BAD_REQUEST
)
api = "NMT-TTS"
else:
return Response(
{"message": "Invalid task"}, status=status.HTTP_400_BAD_REQUEST
Expand Down
2 changes: 1 addition & 1 deletion backend/transcript/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Show particular fields in the admin panel
class TranscriptAdmin(admin.ModelAdmin):
list_display = ("task", "video", "language", "transcript_type", "updated_at", "id")
list_display = ("task", "video", "language", "transcript_type", "updated_at", "id", "status")
list_filter = ("video", "language", "transcript_type")
search_fields = ("video", "language", "transcript_type")
ordering = ("-updated_at",)
Expand Down
2 changes: 2 additions & 0 deletions backend/transcript/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
("te", "Telugu"),
("sa", "Sanskrit"),
("ur", "Urdu"),
("ne", "Nepali"),
]

TRANSCRIPTION_SUPPORTED_LANGUAGES = {
Expand All @@ -29,4 +30,5 @@
"Tamil": "ta",
"Telugu": "te",
"Urdu": "ur",
"Nepali": "ne",
}
3 changes: 3 additions & 0 deletions backend/transcript/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
name="generate_original_transcript",
),
path("save/", views.save_transcription, name="save_transcript"),
path("reopen_completed_transcription_task/", views.reopen_completed_transcription_task, name="reopen_completed_transcription_task"),
path("get_transcription_status/", views.fetch_transcript_status, name="get_transcription_status"),
path("set_transcription_status/", views.update_transcript_status, name="set_transcription_status"),
path(
"save_full_transcript/",
views.save_full_transcription,
Expand Down
Loading
Loading