Omnibus commited on
Commit
c392ffa
·
verified ·
1 Parent(s): cac16a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -289,7 +289,7 @@ def compress_data_og(c, instruct, history):
289
 
290
 
291
 
292
- def summarize(inp,history,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
293
  json_box=[]
294
  if inp == "":
295
  inp = "Process this data"
@@ -366,14 +366,17 @@ def summarize(inp,history,data=None,files=None,url=None,pdf_url=None,pdf_batch=N
366
 
367
  #json_box.append(json_out)
368
  out = str(json_out)
369
- rl = len(out)
370
- print(f'rl:: {rl}')
371
- c=1
372
- for i in str(out):
373
- if i == " " or i=="," or i=="\n":
374
- c +=1
375
- print (f'c2:: {c}')
376
- rawp = compress_data_og(c,inp,out)
 
 
 
377
  else:
378
  rawp = "Provide a valid data source"
379
  #print (rawp)
@@ -395,6 +398,7 @@ with gr.Blocks() as app:
395
  with gr.Column(scale=3):
396
  prompt=gr.Textbox(label = "Instructions (optional)")
397
  with gr.Column(scale=1):
 
398
  button=gr.Button()
399
 
400
  #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
@@ -417,6 +421,6 @@ with gr.Blocks() as app:
417
  #text=gr.JSON()
418
  #inp_query.change(search_models,inp_query,models_dd)
419
  clear_btn.click(clear_fn,None,[prompt,chatbot])
420
- go=button.click(summarize,[prompt,chatbot,data,file,url,pdf_url,pdf_batch],[prompt,chatbot,e_box,json_out])
421
  stop_button.click(None,None,None,cancels=[go])
422
  app.launch(server_port=7860,show_api=False)
 
289
 
290
 
291
 
292
+ def summarize(inp,history,report_check,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
293
  json_box=[]
294
  if inp == "":
295
  inp = "Process this data"
 
366
 
367
  #json_box.append(json_out)
368
  out = str(json_out)
369
+ if report_check:
370
+ rl = len(out)
371
+ print(f'rl:: {rl}')
372
+ c=1
373
+ for i in str(out):
374
+ if i == " " or i=="," or i=="\n":
375
+ c +=1
376
+ print (f'c2:: {c}')
377
+ rawp = compress_data_og(c,inp,out)
378
+ else:
379
+ rawp = out
380
  else:
381
  rawp = "Provide a valid data source"
382
  #print (rawp)
 
398
  with gr.Column(scale=3):
399
  prompt=gr.Textbox(label = "Instructions (optional)")
400
  with gr.Column(scale=1):
401
+ report_check=gr.Checkbox(label="Return Report", value=True)
402
  button=gr.Button()
403
 
404
  #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
 
421
  #text=gr.JSON()
422
  #inp_query.change(search_models,inp_query,models_dd)
423
  clear_btn.click(clear_fn,None,[prompt,chatbot])
424
+ go=button.click(summarize,[prompt,chatbot,report_check,data,file,url,pdf_url,pdf_batch],[prompt,chatbot,e_box,json_out])
425
  stop_button.click(None,None,None,cancels=[go])
426
  app.launch(server_port=7860,show_api=False)