|
@@ -47,9 +47,20 @@ class GoogleAI(object):
|
|
|
if video.state.name != 'ACTIVE':
|
|
|
genai.delete_file(name=video.name)
|
|
|
return
|
|
|
+ # 定义 response_schema
|
|
|
+ response_schema = {
|
|
|
+ "type": "object",
|
|
|
+ "properties": {
|
|
|
+ "text": {
|
|
|
+ "type": "string"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "required": ["text"]
|
|
|
+ }
|
|
|
model = genai.GenerativeModel(
|
|
|
model_name='gemini-1.5-flash',
|
|
|
- generation_config=genai.GenerationConfig(response_mime_type='application/json'),
|
|
|
+ generation_config=genai.GenerationConfig(response_mime_type='application/json',
|
|
|
+ response_schema=response_schema),
|
|
|
safety_settings={
|
|
|
HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,
|
|
|
},
|
|
@@ -79,6 +90,5 @@ class GoogleAI(object):
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- GoogleAI.run("AIzaSyAwGqthDADh5NPVe3BMcOJBQkJaf0HWBuQ",
|
|
|
- "http://rescdn.yishihui.com/jq_oss/video/2025012215472528213")
|
|
|
-
|
|
|
+ GoogleAI.run("AIzaSyDWNwy7SIHLaJ7gROE7qeLB5XjDIDIq644",
|
|
|
+ "/Users/zhangliang/Downloads/FC8VomZVnZ6t9tTGkmN5I5ubG2nTqoCxsw1f5hspINAXuqAT8kxQeGreofBahmI3WVGGsVb9iYhzhEnZH0svtl3g4JLTVQhwaFzQCTK3gPo8MH6QaHb-VFLDQwrRbt3S1IHgCQCwi_X12ZXH6NXam7pGCKHyrI7maUwG43o76UNuX9CuYaH9z9QviuE0LkmI.mp4")
|