Spaces:
Sleeping
Sleeping
FridayMaster
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import pandas as pd
|
2 |
import fitz # PyMuPDF for PDF extraction
|
3 |
import spacy
|
4 |
-
from
|
5 |
-
from
|
6 |
from langchain_community.vectorstores import FAISS # Updated import
|
7 |
import torch
|
8 |
from transformers import AutoTokenizer, AutoModel
|
@@ -18,7 +18,7 @@ def extract_text_from_pdf(pdf_path):
|
|
18 |
return text
|
19 |
|
20 |
# Extract text from the PDF
|
21 |
-
pdf_text = extract_text_from_pdf('
|
22 |
|
23 |
# Convert the text to a DataFrame
|
24 |
df = pd.DataFrame({'text': [pdf_text]})
|
@@ -77,4 +77,3 @@ iface = gr.Interface(
|
|
77 |
if __name__ == "__main__":
|
78 |
iface.launch()
|
79 |
|
80 |
-
|
|
|
1 |
import pandas as pd
|
2 |
import fitz # PyMuPDF for PDF extraction
|
3 |
import spacy
|
4 |
+
from langchain_community.chains import ConversationalRetrievalChain
|
5 |
+
from langchain_community.llms import OpenAI # Updated import
|
6 |
from langchain_community.vectorstores import FAISS # Updated import
|
7 |
import torch
|
8 |
from transformers import AutoTokenizer, AutoModel
|
|
|
18 |
return text
|
19 |
|
20 |
# Extract text from the PDF
|
21 |
+
pdf_text = extract_text_from_pdf('Getting_Started_with_Ubuntu_16.04.pdf') # Replace with your PDF path
|
22 |
|
23 |
# Convert the text to a DataFrame
|
24 |
df = pd.DataFrame({'text': [pdf_text]})
|
|
|
77 |
if __name__ == "__main__":
|
78 |
iface.launch()
|
79 |
|
|