Skip to content

Frea1 #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Frea1 #196

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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ data/
embedding_model/*
!embedding_model/.ignore
.DS_Store
.conda
.gitignore
160 changes: 160 additions & 0 deletions FREAloadcontent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@

def readfile(file_info):
pathname = file_info['path']
if file_info['type'] == 'text/plain':
with open(pathname, 'r') as file:
data = file.read()
return data
if file_info['type'] == 'application/pdf':
pdf_text = ""
try:
fd = open(pathname, "rb")
viewer = SimplePDFViewer(fd)
pdf_text = viewer.render()
except Exception as e:
print(f"Error reading PDF file: {e}")
return pdf_text


def maketags(file_info):
substraction = 'C:/SyncedFolder/Team Shares/FREA/'
pathname = file_info['path']
tagstring = pathname.replace(substraction, '')
tagstring2 = tagstring.replace(file_info['name'], '')
tags = tagstring2.split('/')
print(tags)
return tags

def process_file_getinfo(file_info):
return_data = {}
#data =readfile(file_info)
tags = maketags(file_info)
#return_data['data'] = data
#return_data['tags'] = tags

return tags


def functext(file_info):
process_file_getinfo(file_info)


#text/html
def funcWebPages(file_info):
process_file_getinfo(file_info)

# 'text/markdown':
def funcMarkdown(file_info):
process_file_getinfo(file_info)

# 'application/xml':
def funcXML(file_info):
process_file_getinfo(file_info)

# 'application/pdf':
def funcPDF(file_info):
process_file_getinfo(file_info)

# 'application/msword':
def funcDOC(file_info):
process_file_getinfo(file_info)

# 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
def funcDOCX(file_info):
process_file_getinfo(file_info)

# 'application/vnd.ms-excel (XLS)':
def funcXLS(file_info):
process_file_getinfo(file_info)

# 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
def funcXLSX(file_info):
process_file_getinfo(file_info)

# 'application/vnd.ms-powerpoint (PPT)':
def funcPPT(file_info):
process_file_getinfo(file_info)

# 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
def funcPPTX(file_info):
process_file_getinfo(file_info)

# 'application/rtf':
def funcRTF(file_info):
process_file_getinfo(file_info)

# 'image/jpeg':
def funcJPG(file_info):
process_file_getinfo(file_info)

# 'image/png':
def funcPNG(file_info):
process_file_getinfo(file_info)

# 'image/gif':
def funcGIF(file_info):
process_file_getinfo(file_info)

# 'image/bmp':
def funcBMP(file_info):
process_file_getinfo(file_info)

# 'image/tiff':
def funcTIFF(file_info):
process_file_getinfo(file_info)

# 'application/javascript':
def funcJavaScript(file_info):
process_file_getinfo(file_info)

# 'application/zip':
def funcZIP(file_info):
process_file_getinfo(file_info)

# 'application/gzip':
def funcGZIP(file_info):
process_file_getinfo(file_info)

# 'audio/mpeg':
def funcMP3(file_info):
process_file_getinfo(file_info)

# 'video/mp4':
def funcMP4(file_info):
process_file_getinfo(file_info)

# 'audio/wav':
def funcWAV(file_info):
process_file_getinfo(file_info)

# 'audio/ogg':
def funcOGG(file_info):
process_file_getinfo(file_info)

# 'video/webm':
def funcWEBM(file_info):
process_file_getinfo(file_info)

# 'application/json':
def funcJSON(file_info):
process_file_getinfo(file_info)

# 'application/x-yaml':
def funcYAML(file_info):
process_file_getinfo(file_info)

# 'application/epub+zip':
def funcEPUB(file_info):
process_file_getinfo(file_info)

# 'application/x-mobipocket-ebook':
def funcMOBI(file_info):
process_file_getinfo(file_info)

def funcnone(file_info):
process_file_getinfo(file_info)





24 changes: 24 additions & 0 deletions FREAloader.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM langchain/langchain

WORKDIR /app

RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt .

RUN pip install --upgrade -r requirements.txt

COPY FREAloader.py .
COPY utils.py .
COPY chains.py .
COPY images ./images

EXPOSE 8506

HEALTHCHECK CMD curl --fail http://localhost:8502/_stcore/health

ENTRYPOINT ["streamlit", "run", "FREAloader.py", "--server.port=8506", "--server.address=0.0.0.0"]
Loading