Slaiwala commited on
Commit
dd6c279
·
verified ·
1 Parent(s): d940479

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -11
app.py CHANGED
@@ -906,23 +906,37 @@ with gr.Blocks(theme="soft") as demo:
906
  outputs=[gate, app, state, gate_msg],
907
  )
908
 
909
- send_btn.click(predict, inputs=[user_in, chat, state],
910
- outputs=[chat, user_in, feedback_grp, rating, comment, state])
911
- user_in.submit(predict, inputs=[user_in, chat, state],
912
- outputs=[chat, user_in, feedback_grp, rating, comment, state])
 
 
 
 
 
 
 
 
 
913
 
914
- clear_btn.click(lambda: ([], "", gr.update(visible=False), None, "", init_session()),
915
- inputs=None,
916
- outputs=[chat, user_in, feedback_grp, rating, comment, state])
 
 
 
917
 
918
  submit_fb.click(
919
  fn=save_feedback,
920
  inputs=[rating, comment, state],
921
  outputs=[fb_status, feedback_grp],
 
922
  )
923
 
924
- demo.queue(
925
- concurrency_count=int(os.environ.get("CONCURRENCY", "2")),
926
- max_size=64
927
- ).launch()
 
928
 
 
906
  outputs=[gate, app, state, gate_msg],
907
  )
908
 
909
+ send_btn.click(
910
+ predict,
911
+ inputs=[user_in, chat, state],
912
+ outputs=[chat, user_in, feedback_grp, rating, comment, state],
913
+ concurrency_limit=8, # heavy LLM call
914
+ )
915
+
916
+ user_in.submit(
917
+ predict,
918
+ inputs=[user_in, chat, state],
919
+ outputs=[chat, user_in, feedback_grp, rating, comment, state],
920
+ concurrency_limit=8, # heavy LLM call
921
+ )
922
 
923
+ clear_btn.click(
924
+ lambda: ([], "", gr.update(visible=False), None, "", init_session()),
925
+ inputs=None,
926
+ outputs=[chat, user_in, feedback_grp, rating, comment, state],
927
+ concurrency_limit=4,
928
+ )
929
 
930
  submit_fb.click(
931
  fn=save_feedback,
932
  inputs=[rating, comment, state],
933
  outputs=[fb_status, feedback_grp],
934
+ concurrency_limit=4,
935
  )
936
 
937
+
938
+
939
+ demo.queue(max_size=64)
940
+ demo.launch(max_threads=int(os.environ.get("MAX_THREADS", "32")))
941
+
942