Skip to content

Commit

Permalink
wisper
Browse files Browse the repository at this point in the history
  • Loading branch information
aadityamundhalia committed Sep 4, 2023
1 parent c9af7be commit 35f2c83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN apt-get update && apt-get install -y \
libgeos-dev \
pandoc \
binutils \
ffmpeg \
curl \
build-essential && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
Expand Down
14 changes: 11 additions & 3 deletions backend/parsers/wisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import time
from langchain.schema import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
from models.files import File
from models import Brain, File
from models.settings import get_documents_vector_store
from utils.file import compute_sha1_from_content

from utils.vectors import Neurons

async def process_wisper(
file: File,
Expand Down Expand Up @@ -74,7 +74,15 @@ async def process_wisper(
for text in texts
]

documents_vector_store.add_documents(docs_with_metadata)
# documents_vector_store.add_documents(docs_with_metadata)
for doc in docs_with_metadata: # pyright: ignore reportPrivateUsage=none
neurons = Neurons()
created_vector = neurons.create_vector(doc, user_openai_api_key)

created_vector_id = created_vector[0] # pyright: ignore reportPrivateUsage=none

brain = Brain(id=brain_id)
brain.create_brain_vector(created_vector_id, file.file_sha1)

finally:
if temp_filename and os.path.exists(temp_filename):
Expand Down
2 changes: 1 addition & 1 deletion backend/utils/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def filter_file(
):
await file.compute_file_sha1()

print("file sha1", file.file_sha1)
# print("file sha1", file.file_sha1)
file_exists = file.file_already_exists()
file_exists_in_brain = file.file_already_exists_in_brain(brain_id)

Expand Down

0 comments on commit 35f2c83

Please sign in to comment.