Spaces:
Sleeping
Sleeping
ariankhalfani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
import requests
|
3 |
import streamlit as st
|
4 |
-
import
|
5 |
|
6 |
# Get the Hugging Face API Token from environment variables
|
7 |
HF_API_TOKEN = os.getenv("HF_API_KEY")
|
@@ -19,10 +19,8 @@ def query_model(api_url, payload):
|
|
19 |
|
20 |
def extract_pdf_text(uploaded_file):
|
21 |
pdf_text = ""
|
22 |
-
pdf_reader =
|
23 |
-
|
24 |
-
for page_num in range(num_pages):
|
25 |
-
page = pdf_reader.getPage(page_num)
|
26 |
pdf_text += page.extract_text()
|
27 |
return pdf_text
|
28 |
|
|
|
1 |
import os
|
2 |
import requests
|
3 |
import streamlit as st
|
4 |
+
from PyPDF2 import PdfReader
|
5 |
|
6 |
# Get the Hugging Face API Token from environment variables
|
7 |
HF_API_TOKEN = os.getenv("HF_API_KEY")
|
|
|
19 |
|
20 |
def extract_pdf_text(uploaded_file):
|
21 |
pdf_text = ""
|
22 |
+
pdf_reader = PdfReader(uploaded_file)
|
23 |
+
for page in pdf_reader.pages:
|
|
|
|
|
24 |
pdf_text += page.extract_text()
|
25 |
return pdf_text
|
26 |
|