Update crew.py
Browse files
crew.py
CHANGED
|
@@ -9,7 +9,6 @@ from crewai_tools import (
|
|
| 9 |
from openai import OpenAI
|
| 10 |
from openinference.instrumentation.crewai import CrewAIInstrumentor
|
| 11 |
from phoenix.otel import register
|
| 12 |
-
from pytubefix import YouTube
|
| 13 |
from util import get_final_answer, get_img_b64
|
| 14 |
|
| 15 |
## LLMs
|
|
@@ -119,15 +118,13 @@ def run_crew(question, file_path):
|
|
| 119 |
Raises:
|
| 120 |
RuntimeError: If processing fails"""
|
| 121 |
try:
|
| 122 |
-
# YouTube
|
| 123 |
-
|
| 124 |
-
print("##################################################################")
|
| 125 |
-
print(url)
|
| 126 |
-
file_path = "audio.mp4"
|
| 127 |
-
yt = YouTube(url, client="WEB_CREATOR")
|
| 128 |
-
stream = yt.streams.filter(only_audio=True).first()
|
| 129 |
-
stream.download(filename=file_path)
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
# OpenAI
|
| 132 |
|
| 133 |
client = OpenAI()
|
|
@@ -156,13 +153,13 @@ def run_crew(question, file_path):
|
|
| 156 |
Raises:
|
| 157 |
RuntimeError: If processing fails"""
|
| 158 |
try:
|
| 159 |
-
# YouTube
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
# Get video TODOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo
|
| 167 |
|
| 168 |
video = cv2.VideoCapture(file_path)
|
|
|
|
| 9 |
from openai import OpenAI
|
| 10 |
from openinference.instrumentation.crewai import CrewAIInstrumentor
|
| 11 |
from phoenix.otel import register
|
|
|
|
| 12 |
from util import get_final_answer, get_img_b64
|
| 13 |
|
| 14 |
## LLMs
|
|
|
|
| 118 |
Raises:
|
| 119 |
RuntimeError: If processing fails"""
|
| 120 |
try:
|
| 121 |
+
# YouTube (hack to deal with access issues)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
+
if url.endswith("1htKBjuUWec"):
|
| 124 |
+
file_path = "data/1htKBjuUWec.mp4"
|
| 125 |
+
else:
|
| 126 |
+
raise RuntimeError()
|
| 127 |
+
|
| 128 |
# OpenAI
|
| 129 |
|
| 130 |
client = OpenAI()
|
|
|
|
| 153 |
Raises:
|
| 154 |
RuntimeError: If processing fails"""
|
| 155 |
try:
|
| 156 |
+
# YouTube (hack to deal with access issues)
|
| 157 |
+
|
| 158 |
+
if url.endswith("L1vXCYZAYYM"):
|
| 159 |
+
file_path = "data/L1vXCYZAYYM.mp4"
|
| 160 |
+
else:
|
| 161 |
+
raise RuntimeError()
|
| 162 |
+
|
| 163 |
# Get video TODOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo
|
| 164 |
|
| 165 |
video = cv2.VideoCapture(file_path)
|