Skip to content

Commit

Permalink
fixed video and audio ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed Sep 28, 2023
1 parent 6c3218d commit 7422429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ai_ta_backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def ingest() -> Response:

ingester = Ingest()
success_fail_dict = ingester.bulk_ingest(s3_paths, course_name)
print(f"In /ingest route. success or fail dict: {success_fail_dict}")
print(f"Bottom of /ingest route. success or fail dict: {success_fail_dict}")
del ingester

response = jsonify(success_fail_dict)
Expand Down
6 changes: 3 additions & 3 deletions ai_ta_backend/vector_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def _ingest_single(ingest_method: Callable, s3_path, *args, **kwargs):
_ingest_single(ingest_method, s3_path, course_name, kwargs=kwargs)
elif mime_category in mimetype_ingest_methods:
# fallback to MimeType
ingest_method = file_ingest_methods[mime_category]
print("mime category", mime_category)
ingest_method = mimetype_ingest_methods[mime_category]
_ingest_single(ingest_method, s3_path, course_name, kwargs=kwargs)
else:
# failure
Expand Down Expand Up @@ -329,11 +330,10 @@ def _ingest_single_video(self, s3_path: str, course_name: str, **kwargs) -> str:
"""
Ingest a single video file from S3.
"""
print("Starting ingest video or audio")
try:
# check for file extension
file_ext = Path(s3_path).suffix
print(file_ext[1:])

openai.api_key = os.getenv('OPENAI_API_KEY')
transcript_list = []
with NamedTemporaryFile(suffix=file_ext) as video_tmpfile:
Expand Down

0 comments on commit 7422429

Please sign in to comment.