deepsync commited on
Commit
5236645
·
1 Parent(s): 242aeb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -9,7 +9,8 @@ import requests
9
  load_dotenv()
10
 
11
  video_status = {
12
- "Not Started": "NOT_STARTED",
 
13
  "Dubbing Started": "DUBBING_STARTED",
14
  "Waiting QA": "WAITING_QA",
15
  "Sent to Client": "SENT_TO_CLIENT",
@@ -234,7 +235,13 @@ def get_videos_under_review(platform, status_keys):
234
  API_URL = f"{api_url}/dashboard/dubbed/videos/review/requested/{video_status[status]}"
235
  response = requests.get(API_URL, headers=HEADERS)
236
  if response.status_code == 200:
237
- current_options = [f"{str(v['_id'])} / {v['title']}" for v in response.json()['data'] if 'title' in v]
 
 
 
 
 
 
238
  count[status] = len(current_options)
239
  options.extend(current_options)
240
  data_text = "\n".join([f"{k} : {v} videos" for k,v in count.items()])
@@ -371,7 +378,7 @@ with gr.Blocks() as demo:
371
  with gr.Tab("Assign"):
372
  gr.Markdown("Assign Translator / QA")
373
  source_platform_assign = gr.Radio(["dev", "prod"], value="dev", label="Source Platform")
374
- filter_videos_assign = gr.CheckboxGroup(['Not Started', 'Dubbing Started', 'Waiting QA', 'Sent to Client', 'Approved', 'Rejected', 'Churned', 'Re-review Requested'], label="Filter videos. Do not select any of them for videos without request info.")
375
  video_details = gr.Textbox(label="Video Details")
376
  refresh_assign = gr.Button("Load Videos")
377
  under_review_videos_list = gr.Dropdown([], label="Video IDs")
 
9
  load_dotenv()
10
 
11
  video_status = {
12
+ "Not Assigned": "NOT_STARTED",
13
+ "Under Review": "NOT_STARTED",
14
  "Dubbing Started": "DUBBING_STARTED",
15
  "Waiting QA": "WAITING_QA",
16
  "Sent to Client": "SENT_TO_CLIENT",
 
235
  API_URL = f"{api_url}/dashboard/dubbed/videos/review/requested/{video_status[status]}"
236
  response = requests.get(API_URL, headers=HEADERS)
237
  if response.status_code == 200:
238
+ response_data = response.json()['data']
239
+ if status == "Not Assigned":
240
+ response_data = list(filter(lambda x: x["videoReviewInformation"].get("assignedTranslator") is None, response_data))
241
+ if status == "Under Review":
242
+ response_data = list(filter(lambda x: x["videoReviewInformation"].get("assignedTranslator") is not None, response_data))
243
+ current_options = [f"{str(v['_id'])} / {v['title']}" for v in response_data if 'title' in v]
244
+
245
  count[status] = len(current_options)
246
  options.extend(current_options)
247
  data_text = "\n".join([f"{k} : {v} videos" for k,v in count.items()])
 
378
  with gr.Tab("Assign"):
379
  gr.Markdown("Assign Translator / QA")
380
  source_platform_assign = gr.Radio(["dev", "prod"], value="dev", label="Source Platform")
381
+ filter_videos_assign = gr.CheckboxGroup(['Not Assigned', 'Under Review', 'Dubbing Started', 'Waiting QA', 'Sent to Client', 'Approved', 'Rejected', 'Churned', 'Re-review Requested'], label="Filter videos. Do not select any of them for videos without request info.")
382
  video_details = gr.Textbox(label="Video Details")
383
  refresh_assign = gr.Button("Load Videos")
384
  under_review_videos_list = gr.Dropdown([], label="Video IDs")