NCTCMumbai commited on
Commit
fb15851
·
verified ·
1 Parent(s): 5627b6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -143,13 +143,15 @@ with gr.Blocks() as demo:
143
  )
144
  txt_btn = gr.Button(value="Submit text", scale=1)
145
 
146
- api_kind = gr.Radio(choices=["HuggingFace"], value="HuggingFace")
147
 
148
  prompt_html = gr.HTML()
149
- # Turn off interactivity while generating if you click
150
- txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
151
- bot, [chatbot, api_kind], [chatbot, prompt_html])
152
-
 
 
153
  # Turn it back on
154
  txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
155
  try:
 
143
  )
144
  txt_btn = gr.Button(value="Submit text", scale=1)
145
 
146
+ api_kind = gr.Radio(choices=["HuggingFace","Openai"], value="HuggingFace")
147
 
148
  prompt_html = gr.HTML()
149
+ try:
150
+ # Turn off interactivity while generating if you click
151
+ txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
152
+ bot, [chatbot, api_kind], [chatbot, prompt_html])
153
+ except Exception as e:
154
+ print ('Exception txt btn click ' ,str(e))
155
  # Turn it back on
156
  txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
157
  try: