Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,34 +45,31 @@ if submit_paper:
|
|
| 45 |
tpages = len(list(extract_pages(name)))
|
| 46 |
lst_idx = tpages-1
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
content = get_pages(name, start_page, end_page)
|
| 53 |
-
audio_path = inference(content, "english")
|
| 54 |
-
audio_file = open(audio_path, "rb")
|
| 55 |
-
audio_bytes = audio_file.read()
|
| 56 |
-
st.audio(audio_bytes, format='audio/wav')
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
else:
|
| 76 |
-
st.write("")
|
| 77 |
|
| 78 |
|
|
|
|
| 45 |
tpages = len(list(extract_pages(name)))
|
| 46 |
lst_idx = tpages-1
|
| 47 |
|
| 48 |
+
pgs = [i+1 for i in range(tpages)]
|
| 49 |
|
| 50 |
+
start_page = 1
|
| 51 |
+
end_page = pgs[-1]
|
| 52 |
+
#content = get_pages(name, start_page, end_page)
|
| 53 |
+
#audio_path = inference(content, "english")
|
| 54 |
+
#audio_file = open(audio_path, "rb")
|
| 55 |
+
#audio_bytes = audio_file.read()
|
| 56 |
+
#st.audio(audio_bytes, format='audio/wav')
|
| 57 |
+
with st.form(key = "page_form")
|
| 58 |
+
col1, col2 = st.columns(2)
|
| 59 |
+
with col1:
|
| 60 |
+
s_page = st.selectbox(label = "Start Page", options = pgs)
|
| 61 |
+
start_page = s_page
|
| 62 |
+
with col2:
|
| 63 |
+
print("Last Index ", lst_idx)
|
| 64 |
+
e_page = st.selectbox(label = "End Page", options = pgs, index = lst_idx)
|
| 65 |
+
end_page = e_page
|
| 66 |
+
submit_pages = st.button(label = "Convert To Audio")
|
| 67 |
|
| 68 |
+
if submit_pages:
|
| 69 |
+
content = get_pages(name, start_page, end_page)
|
| 70 |
+
audio_path = inference(content, "english")
|
| 71 |
+
audio_file = open(audio_path, "rb")
|
| 72 |
+
audio_bytes = audio_file.read()
|
| 73 |
+
st.audio(audio_bytes, format='audio/wav')
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
|