Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Title:

Example:

<feature/[Branch Name]> - Brief Title

<Possible Titles Pre-fixes>
* <bugfix/branchName>
* <docs/branchName>
* <hotfix/branchName>
* <release/v1.01branchName>

## What does this change do?

This feature creates ..., It is a bug fix that...

<-- bugfix write-->
<--If a bug fix, give bugfix details fill in details below. Otherwise delete-->

## Bug fix details

### Who discovered this bug?

### On what instance & build was the issue found?

current build

### What is the extent of this bug? (is it an edge case, who is affected, is there an existing workaround, etc)

The bug effects module...

<-- End of bugfix write-->

## Why do we need it?

To ...

## Changes made

- Update `xxx.py` especially methods: ` method_1()` and `mehtod_2()`

## Follows or Closes (e.g., Jira, Ticket Number, Request):

[ticket-#](https://t)

## What might break?

nothing
68 changes: 68 additions & 0 deletions .github/workflows/semantic_search_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Semantic Search Tests

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:

# Set up operating system to test virtually
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.13"]

# Secrets/env variables go here - read from github secrets
#env:
#EXAMPLE_ENVIRONMENT_VARIABLE: ${{ secrets.EXAMPLE_ENVIRONMENT_VARIABLE }}

steps:
# Step 1: Check out the code from the repository
- name: Checkout repository code
uses: actions/checkout@v4

# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Step 3: Install dependencies - notice use of pyproject toml groups instead of requirements
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[ci]

# Step 4: Add any debugging information we want to see
- name: Print debugging information
run: |
echo "Python Version: $(python --version)"
echo "Working Directory: $(pwd)"
echo "Contents of Working Directory: $(ls -l)"

# Step 4: Run Tests
# (pytest .) instructs pytest test framework to discover and execute tests within current and sub directories.
- name: Run pytests
run : pytest .

# Step 5: Continuous Delivery to Dockerhub - Build latest image
- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ github.event_name == 'push'}}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push image to Dockerhub
uses: docker/build-push-action@v4.0.0
if: ${{ github.event_name == 'push'}}
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME}}/semantic_search_app:latest
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ Open a browser and use: http://127.0.0.1:8000

## Special Notes

#you can put these three in an .env folder locally and to add in github secrets for your own actions (see placement in .github/workflow/{}.yml)

API_URL="https://www.googleapis.com/youtube/v3/search" #Publically available API from YOUTUBE
CHANNEL_ID="UCa9gErQ9AE5jT2DZLjXBIdA" # Channel ID of the Shaw Talebi's youtub chanel
MY_YOUTUBE_API_KEY="GET YOUR OWN YOUTUBE API KEY" #link to video of how to get your own API

I ignore warning message like below during testing and running the code.

```
Expand Down Expand Up @@ -181,3 +187,13 @@ Need
12. Monitor the deployment progress in the ECS console to ensure the changes resolve the issue

https://gallery.ecr.aws/docker/library/python

###

Get hub actions

crontabresource
https://crontab.guru/

Setup github actions to generate new image and push to docker.
Complete readme
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"polars>=1.30.0",
"requests>=2.32.3",
"sentence-transformers>=4.1.0",
"types-requests>=2.32.0.20250602",
"youtube-transcript-api>=1.0.3",
]

Expand All @@ -25,3 +26,6 @@ dev = [
"pytest-mock>=3.14.0",
"ruff>=0.11.12",
]

[project.optional-dependencies]
ci = ["pytest", "pytest-cov"]
6 changes: 3 additions & 3 deletions src/functions.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import numpy as np
import polars
import sentence_transformers
from sentence_transformers import SentenceTransformer
import sklearn

def return_search_result_indices(query: str,
df: polars.lazyframe.frame.LazyFrame,
model: sentence_transformers,
model: SentenceTransformer,
dist: sklearn.metrics.DistanceMetric) -> np.ndarray:
"""
Method to return the indices of the top search results

Args:
query (str): The user query string to search for videos
df (polars.lazyframe.frame.LazyFrame): the data
model (sentence_transformers): The sentence transformer model
model (SentenceTransformer): The sentence transformer model
dist (sklearn.metrics.DistanceMetric): The distance measure used here it is Manhattan

Returns:
Expand Down
2 changes: 1 addition & 1 deletion src/get_video_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def make_video_records(response: requests.models.Response) -> list[dict[str,str]

video_record_list.append(video_record)

return video_record_list
return video_record_list

def extract_video_data(
page_token: int,
Expand Down
67 changes: 67 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.