Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions backend/src/PDFExtractor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import fitz # PyMuPDF library

class PDFExtractor:
def __init__(self):
pass

@staticmethod
def extract_text_from_pdf(buffer: bytes) -> str:
"""
Extract text content from a PDF file using a buffer object.

:param buffer: Bytes-like object containing the PDF file content.
:return: String containing the extracted text.
"""
text = ""

try:
# Open the PDF file from the buffer
pdf_document = fitz.open(stream=buffer, filetype="pdf")

# Iterate through each page and extract text
for page_number in range(pdf_document.page_count):
page = pdf_document[page_number]
text += page.get_text()

# Close the PDF document
pdf_document.close()

except Exception as e:
# Handle exceptions (e.g., invalid PDF format)
text = f"Error extracting text: {str(e)}"

return text
Binary file not shown.
Binary file not shown.
17 changes: 13 additions & 4 deletions backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import os
import sys
from ReplicateBot import ReplicateBot
import json
import threading

from ReplicateBot import ReplicateBot, Message

bot = ReplicateBot("mistralai/mixtral-8x7b-instruct-v0.1", os.getenv("REPLICATEKEY"))

bot.Prompt(sys.argv[1])
bot.Run()
bot.Prompt(Message("user", sys.argv[1]))

def Main():
bot.Run()

t = threading.Thread(target=Main)
t.run()

print(bot.Results)
while (True):
print(bot.States[-1].Result)
Binary file added backend/src/tests/Business_Resume.pdf
Binary file not shown.
Binary file added backend/src/tests/sample_resume.pdf
Binary file not shown.