|
@@ -152,10 +152,16 @@ async def main(video_path, api_key, prompt, sample_data):
|
|
|
# 上传并处理视频
|
|
|
upload_response = await analyzer.upload_video( save_path )
|
|
|
if upload_response:
|
|
|
+ if os.path.exists(save_path):
|
|
|
+ os.remove(save_path)
|
|
|
+ logger.info(f"文件已删除: {save_path}")
|
|
|
return upload_response
|
|
|
# 创建缓存模型
|
|
|
model =await analyzer.create_cache()
|
|
|
if isinstance( model, str ):
|
|
|
+ if os.path.exists(save_path):
|
|
|
+ os.remove(save_path)
|
|
|
+ logger.info(f"文件已删除: {save_path}")
|
|
|
return model
|
|
|
logger.success("创建缓存模型成功")
|
|
|
# sample_data = {
|
|
@@ -193,6 +199,9 @@ async def main(video_path, api_key, prompt, sample_data):
|
|
|
# }
|
|
|
response =await analyzer.analyze_video( model, prompt, sample_data )
|
|
|
if isinstance( response, str ):
|
|
|
+ if os.path.exists(save_path):
|
|
|
+ os.remove(save_path)
|
|
|
+ logger.info(f"文件已删除: {save_path}")
|
|
|
return response
|
|
|
logger.info( response.usage_metadata )
|
|
|
logger.info(response.text)
|