minor bux fixed
Browse files- app.py +3 -0
- src/embedder.py +1 -1
- src/labeler.py +3 -0
- src/pinecone_store.py +3 -0
- src/segmenter.py +2 -0
- src/utils.py +3 -0
app.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
import json
|
3 |
from src.pipeline import run_pipeline, search_highlights
|
|
|
|
|
|
|
4 |
|
5 |
def extract(video_file, game_card_str):
|
6 |
video_file.save("uploaded.mp4")
|
|
|
1 |
import gradio as gr
|
2 |
import json
|
3 |
from src.pipeline import run_pipeline, search_highlights
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
|
6 |
+
load_dotenv()
|
7 |
|
8 |
def extract(video_file, game_card_str):
|
9 |
video_file.save("uploaded.mp4")
|
src/embedder.py
CHANGED
@@ -6,7 +6,7 @@ import decord
|
|
6 |
class InternVLEmbedder:
|
7 |
def __init__(self):
|
8 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
-
self.model = AutoModel.from_pretrained("OpenGVLab/InternVL2_5-8B-MPO").to(self.device)
|
10 |
self.processor = AutoProcessor.from_pretrained("OpenGVLab/InternVL2_5-8B-MPO")
|
11 |
|
12 |
def embed_video(self, video_path):
|
|
|
6 |
class InternVLEmbedder:
|
7 |
def __init__(self):
|
8 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
+
self.model = AutoModel.from_pretrained("OpenGVLab/InternVL2_5-8B-MPO", trust_remote_code=True).to(self.device)
|
10 |
self.processor = AutoProcessor.from_pretrained("OpenGVLab/InternVL2_5-8B-MPO")
|
11 |
|
12 |
def embed_video(self, video_path):
|
src/labeler.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
import os
|
2 |
from together import Together
|
|
|
|
|
|
|
3 |
|
4 |
class TogetherLLMLabeler:
|
5 |
def __init__(self):
|
|
|
1 |
import os
|
2 |
from together import Together
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
|
5 |
+
load_dotenv()
|
6 |
|
7 |
class TogetherLLMLabeler:
|
8 |
def __init__(self):
|
src/pinecone_store.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
import pinecone
|
2 |
import os
|
|
|
|
|
|
|
3 |
|
4 |
class PineconeStore:
|
5 |
def __init__(self):
|
|
|
1 |
import pinecone
|
2 |
import os
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
|
5 |
+
load_dotenv()
|
6 |
|
7 |
class PineconeStore:
|
8 |
def __init__(self):
|
src/segmenter.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import cv2
|
2 |
import os
|
3 |
from roboflow import Roboflow
|
|
|
4 |
|
|
|
5 |
## When the ball is no longer detected, we start a new segment
|
6 |
|
7 |
def detect_event_segments(video_path, confidence=0.4):
|
|
|
1 |
import cv2
|
2 |
import os
|
3 |
from roboflow import Roboflow
|
4 |
+
from dotenv import load_dotenv
|
5 |
|
6 |
+
load_dotenv()
|
7 |
## When the ball is no longer detected, we start a new segment
|
8 |
|
9 |
def detect_event_segments(video_path, confidence=0.4):
|
src/utils.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
import cv2
|
2 |
import os
|
|
|
|
|
|
|
3 |
|
4 |
def extract_key_frames(video_path, start_sec, end_sec):
|
5 |
cap = cv2.VideoCapture(video_path)
|
|
|
1 |
import cv2
|
2 |
import os
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
|
5 |
+
load_dotenv()
|
6 |
|
7 |
def extract_key_frames(video_path, start_sec, end_sec):
|
8 |
cap = cv2.VideoCapture(video_path)
|