Skip to content

Commit

Permalink
Update project structure, update READMEs.
Browse files Browse the repository at this point in the history
Change-Id: I72a7567c1665d1414669215b7c733451572cf1cc
  • Loading branch information
softwary committed Oct 8, 2024
1 parent e3da94c commit a4474fe
Show file tree
Hide file tree
Showing 32 changed files with 147 additions and 92 deletions.
100 changes: 8 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,18 @@
## Video Metadata Toolkit
## **Video Metadata AI Toolkit**

### Disclaimer
### **Disclaimer**

This is not an officially supported Google product. The code samples shared here

are not formally supported by Google and are provided only as a reference.

### Introduction
### **Introduction**

This repo currently houses two different use cases: AI Tags (generate metadata
This repo currently houses two different use cases: AI Metadata (generate metadata
for your videos using AI) and Smart Ad Breaks (generate cue points for your VOD
and live video content to insert ads at the right moments).

### AI Tags Development

#### Setup

1. Create a Python virual environment.

2. From inside the environment run `pip install -r requirements.txt`.

3. If you plan to run anything locally, setup your Application Default
Credentials and project ID for GCP.

4. Make sure to run the code from within the video_metadata_toolkit directory.

Application Default Credentials:

```
gcloud auth application-default login
```

Set project ID:

```
gcloud config set project [PROJECT_ID]
```

Input your GCP project ID into the project_configs.py file.

#### Google Cloud

You need a Google Cloud Project to each of these use cases.

These are the APIs you need to enable for the AI-generated metadata tags.

* Cloud Storage

* Cloud Translation API

* Cloud Storage

* Cloud Storage API

* Cloud Speech-to-Text API

* Vertex AI API

##### Run AI Tags Code

[ai_metadata_generator.py](https://github.com/google-marketing-solutions/video-metadata-ai-toolkit/video-metadata-ai-toolkit/ai_metadata_generator.py) has the function which is the main entry point for
running the code:

```
main(
video_id,
video_url,
metadata="",
video_title="",
audio_bucket_name=project_configs.AUDIO_BUCKET_NAME,
transcript_bucket_name=project_configs.TRANSCRIPT_BUCKET_NAME,
)
```

#### Run tests

From the top level project directory:

```
python -m unittest discover video_metadata_toolkit -p "*_test.py"
```
and live video content to insert ads at the right moments). Navigate to their respective
folders to find more info on each of them.

## Code format
## **Code format**

Submitted code should conform to Google's Python style guide. To format code
automatically, run `pyink --pyink-indentation=2 -l 80 [FILENAME]`.
Expand Down Expand Up @@ -132,7 +48,7 @@ adding the following to your `settings.json`:
```

#### Scripts
#### **Scripts**

To manually run tests and the linter:

Expand Down
139 changes: 139 additions & 0 deletions video_metadata_toolkit/ai_metadata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
## **Video Metadata AI Toolkit**

### **Disclaimer**

This is not an officially supported Google product. The code samples shared here
are not formally supported by Google and are provided only as a reference.

### **Introduction**

This is a Python solution which takes a publisher-provided video and generates metadata to tag the video, allowing publishers to better target ads and improve monetization. It does this by downloading the video, stripping out the audio, using Speech-to-Text to get the transcript, and sending that to Gemini to generate the metadata. Publishers can run this solution on their videos as they get uploaded to their CMS, so the metadata can be automatically added.

### **AI Metadata Development**

#### Setup

1. Create a Python virual environment.

2. From inside the environment run `pip install -r requirements.txt`.

3. If you plan to run anything locally, setup your Application Default
Credentials and project ID for GCP.


Application Default Credentials:

```
gcloud auth application-default login
```

Set project ID:

```
gcloud config set project [PROJECT_ID]
```

Input your GCP project ID into the project_configs.py file.


4. Make sure to run the code from within the ai_tags directory.


### **Google Cloud**

You need a Google Cloud Project to each of these use cases.

These are the APIs you need to enable for the AI-generated metadata tags.

* Cloud Storage

* Cloud Translation

* Cloud Speech-to-Text

* Vertex AI

##### **Run AI Metadata Code**

[ai_metadata_generator.py](https://github.com/google-marketing-solutions/video-metadata-ai-toolkit/video-metadata-ai-toolkit/ai_metadata_generator.py) has the function which is the main entry point for
running the code:

```
main(
video_id,
video_url,
metadata="",
video_title="",
audio_bucket_name=project_configs.AUDIO_BUCKET_NAME,
transcript_bucket_name=project_configs.TRANSCRIPT_BUCKET_NAME,
)
```

#### **Run tests**

From the top level project directory:

```
python -m unittest discover video_metadata_toolkit -p "*_test.py"
```

## **Code format**

Submitted code should conform to Google's Python style guide. To format code
automatically, run `pyink --pyink-indentation=2 -l 80 [FILENAME]`.

For VS Code users, you can configure the formatter to run automatically by
adding the following to your `settings.json`:

```
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true
},
"black-formatter.args": [
"--pyink-indentation=2"
],
"black-formatter.path": [
"pyink"
],
```

#### **Scripts**

To manually run tests and the linter:

```
sh test_and_lint.sh
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.

0 comments on commit a4474fe

Please sign in to comment.