OuroborosM commited on
Commit
76bc1a2
·
1 Parent(s): ddf6d4e

add choice

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -483,7 +483,7 @@ agent_OPENAI_MULTI = AgentExecutor.from_agent_and_tools(
483
  # agent.max_execution_time = int(os.getenv("max_iterations"))
484
  # agent.handle_parsing_errors = True
485
  # agent.early_stopping_method = "generate"
486
-
487
  agent = agent_ZEROSHOT_AGENT
488
 
489
  print(agent.agent.llm_chain.prompt.template)
@@ -581,6 +581,15 @@ def read_logs():
581
  with open("output.log", "r") as f:
582
  return f.read()
583
 
 
 
 
 
 
 
 
 
 
584
  with gr.Blocks() as demo:
585
  # gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
586
  main = gr.ChatInterface(
@@ -589,14 +598,18 @@ with gr.Blocks() as demo:
589
  description= "v0.3: Powered by MECH Core Team",
590
  )
591
  with gr.Row():
592
- upload_button = gr.UploadButton("Upload To DB", file_count="multiple", scale= 1)
593
- upload_file_button = gr.UploadButton("Upload File", file_count="single", scale= 1)
 
 
 
594
  voice_input = gr.Audio(source="microphone", type="filepath", scale= 1)
595
  with gr.Accordion("LOGS"):
596
  # logs = gr.Textbox()
597
  logs = gr.Textbox()
598
  upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
599
  demo.load(read_logs, None, logs, every=0.5)
 
600
 
601
 
602
 
 
483
  # agent.max_execution_time = int(os.getenv("max_iterations"))
484
  # agent.handle_parsing_errors = True
485
  # agent.early_stopping_method = "generate"
486
+ global agent
487
  agent = agent_ZEROSHOT_AGENT
488
 
489
  print(agent.agent.llm_chain.prompt.template)
 
581
  with open("output.log", "r") as f:
582
  return f.read()
583
 
584
+ def SetAgent(Choice):
585
+ global agent
586
+ if Choice =='Zero Short Agent':
587
+ agent = agent_ZEROSHOT_AGENT
588
+ elif Choice =='Zero Short React':
589
+ agent = agent_ZEROSHOT_REACT
590
+ elif Choice =='OpenAI Multi':
591
+ agent = agent_OPENAI_MULTI
592
+
593
  with gr.Blocks() as demo:
594
  # gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
595
  main = gr.ChatInterface(
 
598
  description= "v0.3: Powered by MECH Core Team",
599
  )
600
  with gr.Row():
601
+ upload_button = gr.UploadButton("Upload To DB", file_count="multiple", scale= 0)
602
+ upload_file_button = gr.UploadButton("Upload File", file_count="single", scale= 0)
603
+ agentchoice = gr.Dropdown(
604
+ value=['Zero Short Agent','Zero Short React','OpenAI Multi'],
605
+ )
606
  voice_input = gr.Audio(source="microphone", type="filepath", scale= 1)
607
  with gr.Accordion("LOGS"):
608
  # logs = gr.Textbox()
609
  logs = gr.Textbox()
610
  upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
611
  demo.load(read_logs, None, logs, every=0.5)
612
+ agentchoice.change(set, agentchoice, None)
613
 
614
 
615