Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -38,25 +38,26 @@ paper=""
|
|
38 |
if submit_paper:
|
39 |
paper = get_paper(pname)
|
40 |
|
|
|
41 |
if paper:
|
42 |
name = paper.title+'.pdf'
|
43 |
name = name.replace('?', '')
|
44 |
name = "downloads/" + name
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
|
61 |
if submit_pages:
|
62 |
if start_page > end_page:
|
|
|
38 |
if submit_paper:
|
39 |
paper = get_paper(pname)
|
40 |
|
41 |
+
name=""
|
42 |
if paper:
|
43 |
name = paper.title+'.pdf'
|
44 |
name = name.replace('?', '')
|
45 |
name = "downloads/" + name
|
46 |
|
47 |
+
tpages = len(list(extract_pages(name)))
|
48 |
+
print("total pages=", tpages)
|
49 |
+
pgs = [i+1 for i in range(tpages)]
|
50 |
|
51 |
+
start_page = 1
|
52 |
+
end_page = 1
|
53 |
|
54 |
+
with st.form(key = "page_form"):
|
55 |
+
col1, col2 = st.columns(2)
|
56 |
+
with col1:
|
57 |
+
s_page = st.selectbox(label = "Start Page", options = pgs)
|
58 |
+
with col2:
|
59 |
+
e_page = st.selectbox(label = "End Page", options = pgs, index = pgs[-1]-1)
|
60 |
+
submit_pages = st.form_submit_button(label = "Convert To Audio")
|
61 |
|
62 |
if submit_pages:
|
63 |
if start_page > end_page:
|