mylesai commited on
Commit
37022cb
1 Parent(s): 3ae930c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -980,7 +980,7 @@ with gr.Blocks(theme=theme) as block:
980
  chat, query, response = chat_gen.get_chat_engine(dna_documents, api_type)
981
  chat_engine.append(chat)
982
  query_engine.append(query)
983
- return chat_engine, query_engine, response,
984
 
985
  with gr.Column(visible=True, elem_id='login') as login:
986
  options = get_collection_names()
@@ -1036,6 +1036,7 @@ with gr.Blocks(theme=theme) as block:
1036
  This DNA chatbot uses the uploaded dna documents to answer questions
1037
  ''')
1038
  chat_llm = gr.Radio(llms, value=api_type.value, label='Choose LLM', info='Choose which LLM you want to use for content')
 
1039
  chatbot = gr.Chatbot()
1040
  msg = gr.Textbox()
1041
  clear = gr.ClearButton([msg, chatbot])
@@ -1056,7 +1057,7 @@ with gr.Blocks(theme=theme) as block:
1056
  def generate_new_chat_engine(dna_documents, chat_engine, chat_llm):
1057
  chat = chat_gen.get_new_chat_engine(dna_documents, chat_llm)
1058
  chat_engine[0] = chat
1059
- return chat_engine
1060
 
1061
  with gr.Tab("E"):
1062
  with gr.Column(visible=True):
@@ -1094,7 +1095,7 @@ with gr.Blocks(theme=theme) as block:
1094
  bot, [chatbot, chat_engine], chatbot)
1095
  api_type.change(generate_chat_engine)
1096
  clear.click(lambda: None, None, chatbot, queue=False)
1097
- chat_llm.change(fn=generate_new_chat_engine, inputs=[dna_documents, chat_engine, chat_llm], outputs=chat_engine)
1098
  con_gen_btn.click(generate_content, inputs=[website_layout_file, query_engine], outputs=[status, data_preview, download_btn])
1099
  algo_event = algorithm.click(fn=import_client_data, inputs=[selection, zipfile, topical_map, password, project_bool, ai_bool, query_engine], outputs=[upload, err_imgs])
1100
  bf_event = bf_button.click(fn=bf_trigger.run_preprocess_ai, inputs=[bf_topical_map, bf_selection, section, query_engine], outputs=[bf_upload])
@@ -1102,7 +1103,7 @@ with gr.Blocks(theme=theme) as block:
1102
  stop.click(fn=None, inputs=None, outputs=None, cancels=[algo_event])
1103
  stop_bf.click(fn=None, inputs=None, outputs=None, cancels=[bf_event])
1104
  # upload_btn.upload(upload_file, upload_btn, zipfile)
1105
- chat_gen_btn.click(generate_chat_engine, inputs=[dna_documents, chat_engine, query_engine, api_type], outputs=[chat_engine, query_engine, chat_gen_progress])
1106
  # stop_offline.click(fn=None, inputs=None, outputs=None, cancels=[offline_event])
1107
 
1108
  block.queue(default_concurrency_limit=5)
 
980
  chat, query, response = chat_gen.get_chat_engine(dna_documents, api_type)
981
  chat_engine.append(chat)
982
  query_engine.append(query)
983
+ return chat_engine, query_engine, response, f"Chatbot is using {api_type}"
984
 
985
  with gr.Column(visible=True, elem_id='login') as login:
986
  options = get_collection_names()
 
1036
  This DNA chatbot uses the uploaded dna documents to answer questions
1037
  ''')
1038
  chat_llm = gr.Radio(llms, value=api_type.value, label='Choose LLM', info='Choose which LLM you want to use for content')
1039
+ chatbot_status = gr.Label(label='Chabot_Status')
1040
  chatbot = gr.Chatbot()
1041
  msg = gr.Textbox()
1042
  clear = gr.ClearButton([msg, chatbot])
 
1057
  def generate_new_chat_engine(dna_documents, chat_engine, chat_llm):
1058
  chat = chat_gen.get_new_chat_engine(dna_documents, chat_llm)
1059
  chat_engine[0] = chat
1060
+ return chat_engine, f"Chatbot is using {chat_llm}"
1061
 
1062
  with gr.Tab("E"):
1063
  with gr.Column(visible=True):
 
1095
  bot, [chatbot, chat_engine], chatbot)
1096
  api_type.change(generate_chat_engine)
1097
  clear.click(lambda: None, None, chatbot, queue=False)
1098
+ chat_llm.change(fn=generate_new_chat_engine, inputs=[dna_documents, chat_engine, chat_llm], outputs=[chat_engine, chatbot_status])
1099
  con_gen_btn.click(generate_content, inputs=[website_layout_file, query_engine], outputs=[status, data_preview, download_btn])
1100
  algo_event = algorithm.click(fn=import_client_data, inputs=[selection, zipfile, topical_map, password, project_bool, ai_bool, query_engine], outputs=[upload, err_imgs])
1101
  bf_event = bf_button.click(fn=bf_trigger.run_preprocess_ai, inputs=[bf_topical_map, bf_selection, section, query_engine], outputs=[bf_upload])
 
1103
  stop.click(fn=None, inputs=None, outputs=None, cancels=[algo_event])
1104
  stop_bf.click(fn=None, inputs=None, outputs=None, cancels=[bf_event])
1105
  # upload_btn.upload(upload_file, upload_btn, zipfile)
1106
+ chat_gen_btn.click(generate_chat_engine, inputs=[dna_documents, chat_engine, query_engine, api_type], outputs=[chat_engine, query_engine, chat_gen_progress, chatbot_status])
1107
  # stop_offline.click(fn=None, inputs=None, outputs=None, cancels=[offline_event])
1108
 
1109
  block.queue(default_concurrency_limit=5)