Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def read_pdf(pdf_url):
|
|
41 |
page = reader.pages[i]
|
42 |
txt_out+=page.extract_text()
|
43 |
#return txt_out
|
44 |
-
return txt_out.replace("\n","")
|
45 |
|
46 |
def load_data(file):
|
47 |
try:
|
@@ -200,6 +200,8 @@ font-weight=900;
|
|
200 |
"""
|
201 |
def upd_mes(t):
|
202 |
return(f"<div class='mes_div'>Reading PDF: {t}</div>")
|
|
|
|
|
203 |
with gr.Blocks(head=head,css=css) as app:
|
204 |
html=gr.HTML("""<div class='div_title'>PDF Reader to Voice</div>""")
|
205 |
html2=gr.HTML()
|
@@ -221,9 +223,9 @@ with gr.Blocks(head=head,css=css) as app:
|
|
221 |
bulk=gr.Textbox(label="bulk",interactive=False,visible=True)
|
222 |
|
223 |
app.load(None,None,[t,m,l,n,w,p],js=js)
|
224 |
-
tc=t.change(upd_mes,t,html2).then(read_pdf,t,[bulk
|
225 |
mc=m.change(pp.load_mod,m,None)
|
226 |
-
bc=bulk.change(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
227 |
uc=upd.click(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
228 |
sb=save.click(save_data,[t,m,l,n,w,p],save_html)
|
229 |
sc=stp.click(None,None,None, cancels=[tc,mc,bc,uc])
|
|
|
41 |
page = reader.pages[i]
|
42 |
txt_out+=page.extract_text()
|
43 |
#return txt_out
|
44 |
+
return txt_out.replace("\n","")
|
45 |
|
46 |
def load_data(file):
|
47 |
try:
|
|
|
200 |
"""
|
201 |
def upd_mes(t):
|
202 |
return(f"<div class='mes_div'>Reading PDF: {t}</div>")
|
203 |
+
def upd_mes2(t):
|
204 |
+
return(f"<div class='mes_div'>PDF Loaded, creating audio</div>")
|
205 |
with gr.Blocks(head=head,css=css) as app:
|
206 |
html=gr.HTML("""<div class='div_title'>PDF Reader to Voice</div>""")
|
207 |
html2=gr.HTML()
|
|
|
223 |
bulk=gr.Textbox(label="bulk",interactive=False,visible=True)
|
224 |
|
225 |
app.load(None,None,[t,m,l,n,w,p],js=js)
|
226 |
+
tc=t.change(upd_mes,t,html2).then(read_pdf,t,[bulk])
|
227 |
mc=m.change(pp.load_mod,m,None)
|
228 |
+
bc=bulk.change(upd_mes2,None,html).then(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
229 |
uc=upd.click(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
230 |
sb=save.click(save_data,[t,m,l,n,w,p],save_html)
|
231 |
sc=stp.click(None,None,None, cancels=[tc,mc,bc,uc])
|