Skip to content

Commit

Permalink
Merge pull request #4 from Qredence/main
Browse files Browse the repository at this point in the history
Merging
  • Loading branch information
Zochory authored Jul 22, 2024
2 parents 681f1c8 + 2c680a6 commit 631a31e
Show file tree
Hide file tree
Showing 6 changed files with 425 additions and 152 deletions.
23 changes: 23 additions & 0 deletions graphfleet/tools/convert_pdfs_to_txt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
from PyPDF2 import PdfReader

# Directory containing PDF files
directory = 'graphfleet/input/pdf'

# Function to convert PDF to text
def convert_pdf_to_txt(pdf_path, txt_path):
with open(pdf_path, 'rb') as pdf_file:
reader = PdfReader(pdf_file)
text = ''
for page_num in range(len(reader.pages)):
text += reader.pages[page_num].extract_text()
with open(txt_path, 'w', encoding='utf-8') as txt_file:
txt_file.write(text)

# Loop through all PDF files in the directory
for filename in os.listdir(directory):
if filename.endswith('.pdf'):
pdf_path = os.path.join(directory, filename)
txt_path = os.path.join(directory, filename.replace('.pdf', '.txt'))
convert_pdf_to_txt(pdf_path, txt_path)
print(f'Converted {filename} to text.')
25 changes: 9 additions & 16 deletions notebook/get-started-graphfleet.ipynb
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"cell_type": "markdown",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\u001b[31;1mNo module named 'packaging'\u001b[39;22m\n",
"\n",
"\u001b[31;1mNo module named 'packaging'\u001b[39;22m\n"
]
}
],
"source": [
"! poetry shell\n",
"! poetry install\n"
"To use "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
21 changes: 12 additions & 9 deletions notebook/graph-visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"INPUT_DIR = \"/Volumes/Samsung-SSD-T7/Qredence/_Poetry/AgenticFleetPackage/GraphFleetProd/graphfleet/output/20240719-023135/artifacts\"\n",
"INPUT_DIR = \"../graphfleet/output/20240719-023135/artifacts\"\n",
"LANCEDB_URI = f\"{INPUT_DIR}/lancedb\"\n",
"\n",
"COMMUNITY_REPORT_TABLE = \"create_final_community_reports\"\n",
Expand All @@ -103,7 +103,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -142,13 +142,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
Expand Down Expand Up @@ -232,7 +235,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -288,7 +291,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -305,13 +308,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dea34c63aa48405294956a6822606b01",
"model_id": "ab94d989dbee4ddf91c369abd430399b",
"version_major": 2,
"version_minor": 0
},
Expand Down
4 changes: 2 additions & 2 deletions notebook/local_search.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -74,7 +74,7 @@
"metadata": {},
"outputs": [],
"source": [
"INPUT_DIR = \"/Volumes/Samsung-SSD-T7/Qredence/_Poetry/AgenticFleetPackage/GraphFleetProd/graphfleet/output/20240719-023135/artifacts\"\n",
"INPUT_DIR = \"../graphfleet/output/20240719-023135/artifacts\"\n",
"LANCEDB_URI = f\"{INPUT_DIR}/lancedb\"\n",
"\n",
"COMMUNITY_REPORT_TABLE = \"create_final_community_reports\"\n",
Expand Down
Loading

0 comments on commit 631a31e

Please sign in to comment.