Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
from gtts import gTTS
|
3 |
from io import BytesIO
|
4 |
-
|
5 |
-
from pdfminer.pdfinterp import PDFResourceManager, PDFPage.get_pages
|
6 |
-
from pdfminer.converter import TextConverter
|
7 |
-
from pdfminer.layout import LAParams
|
8 |
|
9 |
x = st.slider('Select a value')
|
10 |
slider_reply = x, 'squared is', x * x
|
@@ -12,15 +9,15 @@ st.write(slider_reply)
|
|
12 |
|
13 |
uploaded_file = st.file_uploader("Choose a file", "pdf")
|
14 |
if uploaded_file is not None:
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
element = output.getvalue()
|
23 |
-
|
24 |
with st.popover("Open popover"):
|
25 |
sound_file = BytesIO()
|
26 |
tts = gTTS(element, lang='en')
|
|
|
1 |
import streamlit as st
|
2 |
from gtts import gTTS
|
3 |
from io import BytesIO
|
4 |
+
import fitz
|
|
|
|
|
|
|
5 |
|
6 |
x = st.slider('Select a value')
|
7 |
slider_reply = x, 'squared is', x * x
|
|
|
9 |
|
10 |
uploaded_file = st.file_uploader("Choose a file", "pdf")
|
11 |
if uploaded_file is not None:
|
12 |
+
doc = fitz.open(uploaded_file)
|
13 |
+
|
14 |
+
element = ""
|
15 |
+
|
16 |
+
for page in doc:
|
17 |
+
element+=page.get_text()
|
18 |
|
19 |
element = output.getvalue()
|
20 |
+
print("Created element")
|
21 |
with st.popover("Open popover"):
|
22 |
sound_file = BytesIO()
|
23 |
tts = gTTS(element, lang='en')
|