Archan commited on
Commit
9658861
·
1 Parent(s): 7669f9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -27
app.py CHANGED
@@ -45,34 +45,31 @@ if submit_paper:
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
-
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
- 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