IdoMachlev commited on
Commit
d62e007
·
1 Parent(s): 9f147d5

changed condition to be less error prone

Browse files
Files changed (1) hide show
  1. handler.py +4 -2
handler.py CHANGED
@@ -65,8 +65,10 @@ class WhisperParameterHandler(BaseSettings):
65
  return_timestamps: Optional[Literal["word", True]] = None
66
 
67
  @field_validator("return_timestamps", mode="before")
68
- def cannonize_timestamps(cls, value: Any):
69
- if value == "True":
 
 
70
  logging.info("return_timestamps == 'True'")
71
  return True
72
 
 
65
  return_timestamps: Optional[Literal["word", True]] = None
66
 
67
  @field_validator("return_timestamps", mode="before")
68
+ def cannonize_timestamps(cls, value: Optional[str]):
69
+ if value is None:
70
+ return None
71
+ if value.lower() == "true":
72
  logging.info("return_timestamps == 'True'")
73
  return True
74