Added video references search (codex)
This commit is contained in:
34
main.py
34
main.py
@@ -14,6 +14,7 @@ import torch
|
||||
from asr import Asr, AsrRawResult
|
||||
from asr_filter import AsrFilter, AsrFilterResult
|
||||
from asr_eventizer import AsrEventizer
|
||||
from video_references import VideoReferenceBuilder
|
||||
from structure_builder import Structure, StructureBuilder
|
||||
from structure_refiner import StructureRefiner
|
||||
from markdown_builder import MarkdownBuilder
|
||||
@@ -84,6 +85,21 @@ def setup_arguments() -> argparse.Namespace:
|
||||
type=str,
|
||||
default=ai_api_key
|
||||
)
|
||||
parser.add_argument(
|
||||
"--video-ref-ai-model",
|
||||
type=str,
|
||||
default="google/gemini-3.1-flash-lite"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--video-ref-ai-base-url",
|
||||
type=str,
|
||||
default="https://api.proxyapi.ru/v1"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--video-ref-ai-api-key",
|
||||
type=str,
|
||||
default=ai_api_key
|
||||
)
|
||||
parser.add_argument(
|
||||
"--structure-ai-model",
|
||||
type=str,
|
||||
@@ -215,9 +231,19 @@ def on_video_references(current_step: Step, input_data: dict | None) -> tuple[St
|
||||
if not os.path.isfile("video.mp4"):
|
||||
logging.info("No video, skipping")
|
||||
return (Step.REFERENCE_RESOLVER, None)
|
||||
# NOT IMPLEMENTED
|
||||
logging.warning("Video references are not implemented yet")
|
||||
return (Step.REFERENCE_RESOLVER, None)
|
||||
if input_data is None:
|
||||
logging.error("Can't build video references without input_data")
|
||||
return (None, None)
|
||||
logging.info("Creating the agent")
|
||||
agent = Agent(
|
||||
model=ARGS.video_ref_ai_model,
|
||||
base_url=ARGS.video_ref_ai_base_url,
|
||||
api_key=ARGS.video_ref_ai_api_key
|
||||
)
|
||||
logging.info("Building video references...")
|
||||
builder = VideoReferenceBuilder(agent, Windowizer())
|
||||
result = builder.build(Timeline(**input_data))
|
||||
return (Step.REFERENCE_RESOLVER, result.model_dump(mode="json"))
|
||||
|
||||
def on_reference_resolver(current_step: Step, input_data: dict | None) -> tuple[Step | None, dict | None]:
|
||||
# do not filter if output file exists
|
||||
@@ -230,7 +256,7 @@ def on_reference_resolver(current_step: Step, input_data: dict | None) -> tuple[
|
||||
return (Step.STRUCTURE_BUILDER, input_data)
|
||||
# NOT IMPLEMENTED
|
||||
logging.warning("Reference resolver is not implemented yet")
|
||||
return (Step.STRUCTURE_BUILDER, input_data)
|
||||
return (None, None)
|
||||
|
||||
def on_structure_builder(current_step: Step, input_data: dict | None) -> tuple[Step | None, dict | None]:
|
||||
# don't if done
|
||||
|
||||
Reference in New Issue
Block a user