From 964919708055a175d9770a16942e6ce84c0b71f6 Mon Sep 17 00:00:00 2001 From: Ethio Ai Date: Thu, 2 Nov 2023 19:25:06 +0300 Subject: [PATCH 1/3] Update sample.env --- sample.env | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sample.env b/sample.env index 77da30a..62e2b6c 100644 --- a/sample.env +++ b/sample.env @@ -1,4 +1,4 @@ -API_ID= -API_HASH= -SESSION_NAME= -MONGO_URL= +API_ID=28153993 +API_HASH=976fd7cc4958ad84181a53b41919564b +SESSION_NAME=ethioai +MONGO_URL=mongodb+srv://ethioai:@cluster0.bocbfae.mongodb.net/?retryWrites=true&w=majority From 5283fae8451116b48b7b4e2c91487cb99a141b95 Mon Sep 17 00:00:00 2001 From: Snackshell Date: Sun, 25 May 2025 16:09:52 +0300 Subject: [PATCH 2/3] Created using Colab --- .../veo2_video_generation.ipynb | 468 ++++++++++++++++++ 1 file changed, 468 insertions(+) create mode 100644 vision/getting-started/veo2_video_generation.ipynb diff --git a/vision/getting-started/veo2_video_generation.ipynb b/vision/getting-started/veo2_video_generation.ipynb new file mode 100644 index 0000000..a1b9ba7 --- /dev/null +++ b/vision/getting-started/veo2_video_generation.ipynb @@ -0,0 +1,468 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "KjTHAV8FgEza" + }, + "outputs": [], + "source": [ + "# Copyright 2025 Google LLC\n", + "#\n", + "# Licensed under the Apache License, Version 2.0 (the \"License\");\n", + "# you may not use this file except in compliance with the License.\n", + "# You may obtain a copy of the License at\n", + "#\n", + "# https://www.apache.org/licenses/LICENSE-2.0\n", + "#\n", + "# Unless required by applicable law or agreed to in writing, software\n", + "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", + "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", + "# See the License for the specific language governing permissions and\n", + "# limitations under the License." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "UdL4uvQQs76x" + }, + "source": [ + "# Veo 2 Video Generation\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \"Google
Run in Colab\n", + "
\n", + "
\n", + " \n", + " \"Google
Run in Colab Enterprise\n", + "
\n", + "
\n", + " \n", + " \"Vertex
Open in Vertex AI Workbench\n", + "
\n", + "
\n", + " \n", + " \"GitHub
View on GitHub\n", + "
\n", + "
\n", + "\n", + "
\n", + "\n", + "Share to:\n", + "\n", + "\n", + " \"LinkedIn\n", + "\n", + "\n", + "\n", + " \"Bluesky\n", + "\n", + "\n", + "\n", + " \"X\n", + "\n", + "\n", + "\n", + " \"Reddit\n", + "\n", + "\n", + "\n", + " \"Facebook\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lUCUMoTmN_lJ" + }, + "source": [ + "| | |\n", + "|-|-|\n", + "|Author(s) | [Katie Nguyen](https://github.com/katiemn) |" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "rDjAqcgigwdX" + }, + "source": [ + "## Overview\n", + "\n", + "### Veo 2\n", + "\n", + "Veo 2 on Vertex AI brings Google's state of the art video generation capabilities to application developers. It's capable of creating videos with astonishing detail that simulate real-world physics across a wide range of visual styles.\n", + "\n", + "In this tutorial, you will learn how to use the Google Gen AI SDK for Python to interact with Veo 2 and generate new videos from text prompts and input images." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "v2_iOv5uhXVg" + }, + "source": [ + "## Get started" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "K4uerc9Xhf1f" + }, + "source": [ + "### Install Google Gen AI SDK for Python and other libraries" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "rJyFNKoQhiwF" + }, + "outputs": [], + "source": [ + "%pip install --upgrade --quiet google-genai\n", + "%pip install -q mediapy" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "GWYnCW0-h6HI" + }, + "source": [ + "### Authenticate your notebook environment (Colab only)\n", + "\n", + "If you are running this notebook on Google Colab, run the following cell to authenticate your environment." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "bqz5LUG6h8fA" + }, + "outputs": [], + "source": [ + "import sys\n", + "\n", + "if \"google.colab\" in sys.modules:\n", + " from google.colab import auth\n", + "\n", + " auth.authenticate_user()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "LVrasKoriKZn" + }, + "source": [ + "### Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "oMQf_BkyiMgF" + }, + "outputs": [], + "source": [ + "import time\n", + "import urllib\n", + "\n", + "from PIL import Image as PIL_Image\n", + "from google import genai\n", + "from google.genai import types\n", + "import matplotlib.pyplot as plt\n", + "import mediapy as media" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "yxBkUEqdiB1g" + }, + "source": [ + "### Set Google Cloud project information and create client\n", + "\n", + "To get started using Vertex AI, you must have an existing Google Cloud project and [enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com).\n", + "\n", + "Learn more about [setting up a project and a development environment](https://cloud.google.com/vertex-ai/docs/start/cloud-environment)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "GtjPBmYHiEfx" + }, + "outputs": [], + "source": [ + "import os\n", + "\n", + "PROJECT_ID = \"[your-project-id]\" # @param {type: \"string\", placeholder: \"[your-project-id]\", isTemplate: true}\n", + "if not PROJECT_ID or PROJECT_ID == \"[your-project-id]\":\n", + " PROJECT_ID = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n", + "\n", + "LOCATION = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")\n", + "\n", + "client = genai.Client(vertexai=True, project=PROJECT_ID, location=LOCATION)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qD_bwA9hiMzL" + }, + "source": [ + "### Define helper functions to display media" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "GUrEwbvFiPhJ" + }, + "outputs": [], + "source": [ + "def show_video(gcs_uri):\n", + " file_name = gcs_uri.split(\"/\")[-1]\n", + " !gsutil cp {gcs_uri} {file_name}\n", + " media.show_video(media.read_video(file_name), height=500)\n", + "\n", + "\n", + "def display_images(image) -> None:\n", + " fig, axis = plt.subplots(1, 1, figsize=(12, 6))\n", + " axis.imshow(image)\n", + " axis.set_title(\"Starting Image\")\n", + " axis.axis(\"off\")\n", + " plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2jaSOOadiUj6" + }, + "source": [ + "### Load the video generation model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "APRfTklCiYR2" + }, + "outputs": [], + "source": [ + "video_model = \"veo-2.0-generate-001\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "aDaTx8WCidRG" + }, + "source": [ + "### Generate videos from a text prompt\n", + "\n", + "With Veo 2, you have the option to generate 8 second videos from a text prompt. In order to generate a video in the following sample, specify the following info:\n", + "- **Prompt:** A detailed description of the video you would like to see.\n", + "- **Aspect ratio:** Select either 16:9 or 9:16.\n", + "- **File location:** The generated video will be shown below with support from a previously defined helper function. The video will also be stored in Cloud Storage once video generation is complete. Specify the file path where you would like this video to be stored in the output_gcs field.\n", + "- **Number of videos:** Set this value to 1 or 2.\n", + "- **Video duration:** Can 5, 6, 7, or 8 seconds.\n", + "- **Prompt enhancement:** The `veo-2.0-generate-001` model offers the option to enhance your provided prompt. To utilize this feature, set `enhance_prompt` to True. A new, detailed prompt will be created from your original one to help generate higher quality videos that better adhere to your prompt's intent." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "tygfLLlWyTo_" + }, + "outputs": [], + "source": [ + "prompt = \"a cat reading a book\" # @param {type: 'string'}\n", + "aspect_ratio = \"16:9\" # @param [\"16:9\", \"9:16\"]\n", + "output_gcs = \"gs://\" # @param {type: 'string'}\n", + "\n", + "operation = client.models.generate_videos(\n", + " model=video_model,\n", + " prompt=prompt,\n", + " config=types.GenerateVideosConfig(\n", + " aspect_ratio=aspect_ratio,\n", + " output_gcs_uri=output_gcs,\n", + " number_of_videos=1,\n", + " duration_seconds=5,\n", + " person_generation=\"dont_allow\",\n", + " enhance_prompt=True,\n", + " ),\n", + ")\n", + "\n", + "while not operation.done:\n", + " time.sleep(15)\n", + " operation = client.operations.get(operation)\n", + " print(operation)\n", + "\n", + "if operation.response:\n", + " show_video(operation.result.generated_videos[0].video.uri)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "688nb6GEwqR4" + }, + "source": [ + "When generating videos of people you can also set the `person_generation` parameter accordingly:\n", + "* `person_generation`: allow_adult, dont_allow" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "sp0K0WYUwxLJ" + }, + "outputs": [], + "source": [ + "prompt = \"sculpting a bowl on a pottery wheel\" # @param {type: 'string'}\n", + "aspect_ratio = \"9:16\" # @param [\"16:9\", \"9:16\"]\n", + "output_gcs = \"gs://\" # @param {type: 'string'}\n", + "\n", + "operation = client.models.generate_videos(\n", + " model=video_model,\n", + " prompt=prompt,\n", + " config=types.GenerateVideosConfig(\n", + " aspect_ratio=aspect_ratio,\n", + " output_gcs_uri=output_gcs,\n", + " number_of_videos=1,\n", + " duration_seconds=7,\n", + " person_generation=\"allow_adult\",\n", + " enhance_prompt=True,\n", + " ),\n", + ")\n", + "\n", + "while not operation.done:\n", + " time.sleep(15)\n", + " operation = client.operations.get(operation)\n", + " print(operation)\n", + "\n", + "if operation.response:\n", + " show_video(operation.result.generated_videos[0].video.uri)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "YysYLyiVj8Zd" + }, + "source": [ + "### Generate videos from an image\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "X-NdoBONKpJD" + }, + "source": [ + "#### Load the starting image\n", + "\n", + "You can also generate a video by starting with an input image. Add the Cloud Storage file location of the image you'd like to use to display it below." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "cl_lTdvEIt8k" + }, + "outputs": [], + "source": [ + "image_show = PIL_Image.open(\n", + " urllib.request.urlopen(\n", + " \"/content/image (12).png\"\n", + " )\n", + ")\n", + "display_images(image_show)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "mCc77j59KjGN" + }, + "source": [ + "#### Send the video request\n", + "\n", + "If you're generating a video from an image you don't need to provide a prompt. The model will simply add motion to your image.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "tFgQYeXHnidx" + }, + "outputs": [], + "source": [ + "image_gcs = (\n", + " \"gs://cloud-samples-data/generative-ai/image/flowers.png\" # @param {type: 'string'}\n", + ")\n", + "aspect_ratio = \"16:9\" # @param [\"16:9\", \"9:16\"]\n", + "output_gcs = \"gs://\" # @param {type: 'string'}\n", + "\n", + "operation = client.models.generate_videos(\n", + " model=video_model,\n", + " image=types.Image(\n", + " gcs_uri=image_gcs,\n", + " mime_type=\"image/png\",\n", + " ),\n", + " config=types.GenerateVideosConfig(\n", + " aspect_ratio=aspect_ratio,\n", + " output_gcs_uri=output_gcs,\n", + " number_of_videos=1,\n", + " duration_seconds=8,\n", + " person_generation=\"allow_adult\",\n", + " ),\n", + ")\n", + "\n", + "while not operation.done:\n", + " time.sleep(15)\n", + " operation = client.operations.get(operation)\n", + " print(operation)\n", + "\n", + "if operation.response:\n", + " show_video(operation.result.generated_videos[0].video.uri)" + ] + } + ], + "metadata": { + "colab": { + "name": "veo2_video_generation.ipynb", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file From ee47c5dfaca7adf9fd1a5f1f91dc6368e613f7d1 Mon Sep 17 00:00:00 2001 From: Snackshell Date: Wed, 30 Jul 2025 11:53:46 +0300 Subject: [PATCH 3/3] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6d73e32..cffe267 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@

❤️ ALEXA AI MACHINE BOT ❤️

+hey there + +

A Telegram Userbot For AI Machine System To Increase Your Chat Ranking
... Written With Python, Pyrogram And Mongodb Backend Database...