MCPcopy
hub / github.com/diffgram/diffgram / interpolate_all_frames

Function interpolate_all_frames

walrus/methods/video/interpolation.py:565–612  ·  view source on GitHub ↗

This may be a long running operation for longer videos. Prior we had this start running on a new thread, but that doesn't really make sense since * The user likely wants to see results from this before proceeding * We want to make errors louder, ie not having enough instances etc.

(project_string_id, video_file_id)

Source from the content-addressed store, hash-verified

563 methods = ['POST'])
564@Project_permissions.user_has_project(["admin", "Editor"])
565def interpolate_all_frames(project_string_id, video_file_id):
566 """
567
568 This may be a long running operation for longer videos.
569 Prior we had this start running on a new thread, but that doesn't really make sense since
570 * The user likely wants to see results from this before proceeding
571 * We want to make errors louder, ie not having enough instances etc.
572 * For an "average" case it completes in less < 10 seconds so it&#x27;s not really that long running
573
574 """
575
576 spec_list = [{'directory_id': int}]
577
578 log, input, untrusted_input = regular_input.master(request = request,
579 spec_list = spec_list)
580 if len(log["error"].keys()) >= 1:
581 return jsonify(log = log), 400
582
583 with sessionMaker.session_scope() as session:
584
585 project = Project.get(session, project_string_id)
586
587 directory = WorkingDir.get_with_fallback(
588 session = session,
589 project = project,
590 directory_id = input['directory_id'])
591
592 if directory is False or directory is None:
593 print("Invalid directory")
594 return jsonify("Invalid directory"), 400
595
596 try:
597 video_file = File.get_by_id_untrusted(
598 session = session,
599 user_id = None,
600 project_string_id = project_string_id,
601 file_id = video_file_id,
602 directory_id = directory.id,
603 with_for_update = True,
604 nowait = True)
605 except Exception as e:
606 trace = traceback.format_exc()
607 logger.error(f"File {video_file_id} is Locked")
608 logger.error(trace)
609 log['error']['file_locked'] = 'File is being saved by another process, please try again later.'
610 return jsonify(log), 400
611
612 return interpolate_api_shared(session, log, project, video_file)
613
614
615def interpolate_api_shared(

Callers

nothing calls this directly

Calls 4

interpolate_api_sharedFunction · 0.85
get_with_fallbackMethod · 0.80
get_by_id_untrustedMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected