Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -314,7 +314,7 @@ def get_chart(inp):
|
|
| 314 |
print(f'Error:: {e}')
|
| 315 |
resp = e
|
| 316 |
return resp
|
| 317 |
-
def summarize(inp,history,report_check,chart_check,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
|
| 318 |
json_box=[]
|
| 319 |
error_box=""
|
| 320 |
if inp == "":
|
|
@@ -340,7 +340,9 @@ def summarize(inp,history,report_check,chart_check,data=None,files=None,url=None
|
|
| 340 |
print(e)
|
| 341 |
#data=f'{data}\nError reading URL ({batch_url})'
|
| 342 |
|
| 343 |
-
|
|
|
|
|
|
|
| 344 |
|
| 345 |
if pdf_url.startswith("http"):
|
| 346 |
print("PDF_URL")
|
|
@@ -441,6 +443,8 @@ with gr.Blocks() as app:
|
|
| 441 |
data=gr.Textbox(label="Input Data (paste text)", lines=6)
|
| 442 |
with gr.Tab("File"):
|
| 443 |
file=gr.Files(label="Input File(s) (.pdf .txt)")
|
|
|
|
|
|
|
| 444 |
with gr.Tab("Raw HTML"):
|
| 445 |
url = gr.Textbox(label="URL")
|
| 446 |
with gr.Tab("PDF URL"):
|
|
@@ -452,6 +456,6 @@ with gr.Blocks() as app:
|
|
| 452 |
#text=gr.JSON()
|
| 453 |
#inp_query.change(search_models,inp_query,models_dd)
|
| 454 |
clear_btn.click(clear_fn,None,[prompt,chatbot])
|
| 455 |
-
go=button.click(summarize,[prompt,chatbot,report_check,chart_check,data,file,url,pdf_url,pdf_batch],[prompt,chatbot,e_box,json_out])
|
| 456 |
stop_button.click(None,None,None,cancels=[go])
|
| 457 |
app.queue(default_concurrency_limit=20).launch(show_api=False)
|
|
|
|
| 314 |
print(f'Error:: {e}')
|
| 315 |
resp = e
|
| 316 |
return resp
|
| 317 |
+
def summarize(inp,history,report_check,chart_check,data=None,files=None,directory=None,url=None,pdf_url=None,pdf_batch=None):
|
| 318 |
json_box=[]
|
| 319 |
error_box=""
|
| 320 |
if inp == "":
|
|
|
|
| 340 |
print(e)
|
| 341 |
#data=f'{data}\nError reading URL ({batch_url})'
|
| 342 |
|
| 343 |
+
if directory:
|
| 344 |
+
for ea in directory:
|
| 345 |
+
print(ea)
|
| 346 |
|
| 347 |
if pdf_url.startswith("http"):
|
| 348 |
print("PDF_URL")
|
|
|
|
| 443 |
data=gr.Textbox(label="Input Data (paste text)", lines=6)
|
| 444 |
with gr.Tab("File"):
|
| 445 |
file=gr.Files(label="Input File(s) (.pdf .txt)")
|
| 446 |
+
with gr.Tab("Folder"):
|
| 447 |
+
directory=gr.Files(label="Folder", file_count='directory')
|
| 448 |
with gr.Tab("Raw HTML"):
|
| 449 |
url = gr.Textbox(label="URL")
|
| 450 |
with gr.Tab("PDF URL"):
|
|
|
|
| 456 |
#text=gr.JSON()
|
| 457 |
#inp_query.change(search_models,inp_query,models_dd)
|
| 458 |
clear_btn.click(clear_fn,None,[prompt,chatbot])
|
| 459 |
+
go=button.click(summarize,[prompt,chatbot,report_check,chart_check,data,file,directory,url,pdf_url,pdf_batch],[prompt,chatbot,e_box,json_out])
|
| 460 |
stop_button.click(None,None,None,cancels=[go])
|
| 461 |
app.queue(default_concurrency_limit=20).launch(show_api=False)
|