Spaces:
Running
Running
File size: 955 Bytes
f8c4214 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
from typing import Optional
from pydantic import BaseModel, Field
class YTRequest(BaseModel):
yt_link: str = Field(description="The YouTube video link to be processed")
class YTResult(BaseModel):
id: str = Field(description="The YouTube video ID")
title: str = Field(description="The YouTube video title")
thumbnail_link: str = Field(description="The YouTube video thumbnail link")
uploader: str = Field(description="The YouTube video uploader")
error_code: Optional[int] = Field(description="The error code if any", default=None)
def get_local_file_path(self) -> str:
return f"output/{self.id}.m4a"
class YTResultWithTranscript(YTResult):
transcript: str = Field(description="The YouTube video transcript")
def model_outputs(self) -> list:
return [
self.id,
self.title,
self.thumbnail_link,
self.uploader,
self.transcript,
]
|