Skip to content

Commit

Permalink
feat: adding example notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmanvaidya committed Jan 7, 2025
1 parent f965a12 commit 6a4df81
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
98 changes: 98 additions & 0 deletions examples/01_video_embeddings_tsne_plot.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "880ce57b-d488-48f0-93ea-8c00d11c4cf7",
"metadata": {},
"source": [
"## Install Requried Dependencies"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "c1c2746d-00d1-4a32-8a2c-2ed703177460",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 36.2 ms, sys: 34.8 ms, total: 71 ms\n",
"Wall time: 5.96 s\n"
]
}
],
"source": [
"%%time\n",
"%%capture\n",
"# install feluda and the requried operators\n",
"!uv pip install feluda\n",
"!uv pip install feluda-vid-vec-rep-clip\n",
"!uv pip install feluda-dimension-reduction\n",
"\n",
"# install other packages\n",
"!uv pip install huggingface-hub\n",
"!uv pip install matplotlib"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "41d7b1c6-157e-4c28-b362-2119779c7909",
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'cv2'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[5], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mfeluda\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodels\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmedia_factory\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m VideoFactory\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mhuggingface_hub\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m hf_hub_download\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mcv2\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mtarfile\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpyplot\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mplt\u001b[39;00m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'cv2'"
]
}
],
"source": [
"from feluda import Feluda\n",
"from feluda.models.media_factory import VideoFactory\n",
"\n",
"from huggingface_hub import hf_hub_download\n",
"import cv2\n",
"import tarfile\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.offsetbox import OffsetImage, AnnotationBbox"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "34312b7c-9879-4040-9f13-1f780a09d802",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
9 changes: 9 additions & 0 deletions examples/01_video_embeddings_tsne_plot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
operators:
label: "Operators"
parameters:
- name: "Dimension Reduction"
type: "dimension_reduction"
parameters: { index_name: "video" }
- name: "Video Vector Representation"
type: "vid_vec_rep_clip"
parameters: { index_name: "video" }

0 comments on commit 6a4df81

Please sign in to comment.