# google-ai **Repository Path**: weixin-learning/google-ai ## Basic Information - **Project Name**: google-ai - **Description**: Google AI API调用Demo - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-05 - **Last Updated**: 2026-02-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Google AI 调用示例 (Restructured) 本项目按调用源 (Gemini API / Vertex AI) 和功能进行了重新组织。 ## 目录结构 ### 1. Gemini API (`gemini_api/`) 使用 Google AI Studio 的 API Key 调用。 - **`text_client.py`**: `GeminiText` 类。 ### 2. Vertex AI (`vertex_ai/`) 使用 Google Cloud Vertex AI 平台。 - **`text_client.py`**: `VertexText` 类。 - **`image_generation.py`**: `VertexImage` 类 (Imagen 3)。 - **`video_generation.py`**: `VertexVideo` 类 (Veo 3.1 & 2.0)。 ### 3. 常量配置 (`constants/`) - **`image_style_prompts.py`**: 大师风格/滤镜提示词。 - **`video_camera_prompts.py`**: 视频镜头运动提示词。 ### 4. 工具库 (`utils/`) - **`video_cropping_util.py`**: 视频处理(如提取中间帧)。 ## 安装与配置 ### 1. 环境准备 (Conda) 推荐使用 Conda 管理环境: ```bash # 创建并初始化环境 conda create -n google-ai python=3.10 -y # 激活环境 conda activate google-ai # 安装依赖 pip install -r requirements.txt ``` ### 2. 命令参考 - **启动环境**: `conda activate google-ai` - **退出环境**: `conda deactivate` - **查看依赖**: `pip list` ### 3. 配置环境变量 在 `.env` 中填入你的密钥及项目信息。 ## 使用示例 ```python # 示例:调用视频生成(以图生视频) from vertex_ai.video_generation import VertexVideo from constants.video_camera_prompts import PROMPT_CAMERA_SWOOP_TRACKING vid_gen = VertexVideo() vid_gen.generate( prompt=PROMPT_CAMERA_SWOOP_TRACKING, image_paths=["start.png", "end.png"], output_path="transition.mp4" ) ```