marquesafonso commited on
Commit
009ce34
·
1 Parent(s): d6fce51

move config to variables and secrets (3)

Browse files
Files changed (1) hide show
  1. main.py +6 -6
main.py CHANGED
@@ -24,10 +24,10 @@ class MP4Video(BaseModel):
24
  return self.video_file.file
25
 
26
  @field_validator('video_file')
27
- def validate_video_file(cls, v):
28
- if not v.filename.endswith('.mp4'):
29
  raise HTTPException(status_code=500, detail='Invalid video file type. Please upload an MP4 file.')
30
- return v
31
 
32
  class SRTFile(BaseModel):
33
  srt_file: Optional[UploadFile] = None
@@ -43,10 +43,10 @@ class SRTFile(BaseModel):
43
  return self.srt_file.size
44
 
45
  @field_validator('srt_file')
46
- def validate_srt_file(cls, v):
47
- if v.size > 0 and not v.filename.endswith('.srt'):
48
  raise HTTPException(status_code=422, detail='Invalid subtitle file type. Please upload an SRT file.')
49
- return v
50
 
51
  @app.get("/")
52
  async def root():
 
24
  return self.video_file.file
25
 
26
  @field_validator('video_file')
27
+ def validate_video_file(cls, self):
28
+ if not self.filename.endswith('.mp4'):
29
  raise HTTPException(status_code=500, detail='Invalid video file type. Please upload an MP4 file.')
30
+ return self
31
 
32
  class SRTFile(BaseModel):
33
  srt_file: Optional[UploadFile] = None
 
43
  return self.srt_file.size
44
 
45
  @field_validator('srt_file')
46
+ def validate_srt_file(cls, self):
47
+ if self.size > 0 and not self.filename.endswith('.srt'):
48
  raise HTTPException(status_code=422, detail='Invalid subtitle file type. Please upload an SRT file.')
49
+ return self
50
 
51
  @app.get("/")
52
  async def root():