Spaces:
Running
Running
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:
|
@@ -191,8 +191,11 @@ height:500px;
|
|
191 |
width:100%;
|
192 |
}
|
193 |
"""
|
|
|
|
|
194 |
with gr.Blocks(head=head,css=css) as app:
|
195 |
html=gr.HTML()
|
|
|
196 |
a=gr.Audio(streaming=True,autoplay=True)
|
197 |
with gr.Accordion("Voice Controls",open=False):
|
198 |
with gr.Row():
|
@@ -211,7 +214,7 @@ with gr.Blocks(head=head,css=css) as app:
|
|
211 |
bulk=gr.Textbox(label="bulk",interactive=False,visible=True)
|
212 |
|
213 |
app.load(None,None,[t,m,l,n,w,p],js=js)
|
214 |
-
tc=t.change(read_pdf,t,bulk)
|
215 |
mc=m.change(pp.load_mod,m,None)
|
216 |
bc=bulk.change(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
217 |
uc=upd.click(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
|
|
41 |
page = reader.pages[i]
|
42 |
txt_out+=page.extract_text()
|
43 |
#return txt_out
|
44 |
+
return txt_out.replace("\n",""),"PDF Loaded, creating audio"
|
45 |
|
46 |
def load_data(file):
|
47 |
try:
|
|
|
191 |
width:100%;
|
192 |
}
|
193 |
"""
|
194 |
+
def upd_mes(t):
|
195 |
+
return(f"Reading PDF: {t}")
|
196 |
with gr.Blocks(head=head,css=css) as app:
|
197 |
html=gr.HTML()
|
198 |
+
html2=gr.HTML()
|
199 |
a=gr.Audio(streaming=True,autoplay=True)
|
200 |
with gr.Accordion("Voice Controls",open=False):
|
201 |
with gr.Row():
|
|
|
214 |
bulk=gr.Textbox(label="bulk",interactive=False,visible=True)
|
215 |
|
216 |
app.load(None,None,[t,m,l,n,w,p],js=js)
|
217 |
+
tc=t.change(upd_mes,t,html).then(read_pdf,t,[bulk,html])
|
218 |
mc=m.change(pp.load_mod,m,None)
|
219 |
bc=bulk.change(pp.stream_tts,[bulk,m,l,n,w,p],a)
|
220 |
uc=upd.click(pp.stream_tts,[bulk,m,l,n,w,p],a)
|