Omnibus commited on
Commit
03ca010
·
verified ·
1 Parent(s): 87125cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -265,14 +265,16 @@ def compress_data_og(c, instruct, history):
265
 
266
  def get_chart(inp):
267
  seed=random.randint(1,1000000000)
268
-
269
- resp = run_gpt(
270
- GET_CHART,
271
- stop_tokens=["observation:", "task:", "action:", "thought:"],
272
- max_tokens=8192,
273
- seed=seed,
274
- inp=inp,
275
- )
 
 
276
  return resp
277
  def summarize(inp,history,report_check,chart_check,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
278
  json_box=[]
@@ -413,4 +415,4 @@ with gr.Blocks() as app:
413
  clear_btn.click(clear_fn,None,[prompt,chatbot])
414
  go=button.click(summarize,[prompt,chatbot,report_check,chart_check,data,file,url,pdf_url,pdf_batch],[prompt,chatbot,e_box,json_out])
415
  stop_button.click(None,None,None,cancels=[go])
416
- app.queue(default_concurrency_limit=20).launch(server_port=7860,show_api=False)
 
265
 
266
  def get_chart(inp):
267
  seed=random.randint(1,1000000000)
268
+ try:
269
+ resp = run_gpt(
270
+ GET_CHART,
271
+ stop_tokens=["observation:", "task:", "action:", "thought:"],
272
+ max_tokens=8192,
273
+ seed=seed,
274
+ inp=inp,
275
+ ).strip("\n")
276
+ except Exception as e:
277
+ resp = e
278
  return resp
279
  def summarize(inp,history,report_check,chart_check,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
280
  json_box=[]
 
415
  clear_btn.click(clear_fn,None,[prompt,chatbot])
416
  go=button.click(summarize,[prompt,chatbot,report_check,chart_check,data,file,url,pdf_url,pdf_batch],[prompt,chatbot,e_box,json_out])
417
  stop_button.click(None,None,None,cancels=[go])
418
+ app.queue(default_concurrency_limit=20).launch(show_api=False)