Spaces:
Runtime error
Runtime error
medelharchaoui
commited on
Commit
·
46d9645
1
Parent(s):
af7b253
create app.y
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PyPDF2 import PdfFileReader
|
3 |
+
|
4 |
+
def read_pdf(file):
|
5 |
+
pdf = PdfFileReader(file)
|
6 |
+
text = ""
|
7 |
+
for page in range(pdf.getNumPages()):
|
8 |
+
text += pdf.getPage(page).extractText()
|
9 |
+
return text
|
10 |
+
|
11 |
+
st.title('PDF Text Extractor')
|
12 |
+
|
13 |
+
uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
|
14 |
+
if uploaded_file is not None:
|
15 |
+
text = read_pdf(uploaded_file)
|
16 |
+
st.write(text)
|