Spaces:
sierrafr
/
Runtime error

hadadrjt commited on
Commit
bb792fe
·
1 Parent(s): 28ea51f

ai: Redesign the layouts.

Browse files
Files changed (1) hide show
  1. jarvis.py +5 -7
jarvis.py CHANGED
@@ -361,14 +361,12 @@ with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], h
361
  user_history = gr.State([])
362
  user_session = gr.State(create_session())
363
  selected_model = gr.State(MODEL_CHOICES[0] if MODEL_CHOICES else "")
364
- custom_prompt_state = gr.State("")
365
  chatbot = gr.Chatbot(label=AI_TYPES["AI_TYPE_1"], show_copy_button=True, scale=1, elem_id=AI_TYPES["AI_TYPE_2"])
366
  msg = gr.MultimodalTextbox(show_label=False, placeholder=RESPONSES["RESPONSE_5"], interactive=True, file_count="single", file_types=ALLOWED_EXTENSIONS)
367
- with gr.Accordion(AI_TYPES["AI_TYPE_6"], open=False):
368
- model_dropdown = gr.Dropdown(show_label=False, choices=MODEL_CHOICES, value=MODEL_CHOICES[0])
369
- system_prompt = gr.Textbox(label=AI_TYPES["AI_TYPE_7"], lines=2, interactive=True, visible=False)
370
- model_dropdown.change(fn=change_model, inputs=[model_dropdown], outputs=[user_history, user_session, selected_model, custom_prompt_state, system_prompt])
371
- system_prompt.change(fn=lambda x: x, inputs=[system_prompt], outputs=[custom_prompt_state])
372
- msg.submit(fn=respond_async, inputs=[msg, user_history, selected_model, user_session, custom_prompt_state], outputs=[chatbot, msg, user_session], api_name=INTERNAL_AI_GET_SERVER)
373
  msg.stop(fn=stop_response, inputs=[user_history, user_session], outputs=[chatbot, msg, user_session])
374
  jarvis.queue(default_concurrency_limit=2).launch(max_file_size="1mb")
 
361
  user_history = gr.State([])
362
  user_session = gr.State(create_session())
363
  selected_model = gr.State(MODEL_CHOICES[0] if MODEL_CHOICES else "")
364
+ J_A_R_V_I_S = gr.State("")
365
  chatbot = gr.Chatbot(label=AI_TYPES["AI_TYPE_1"], show_copy_button=True, scale=1, elem_id=AI_TYPES["AI_TYPE_2"])
366
  msg = gr.MultimodalTextbox(show_label=False, placeholder=RESPONSES["RESPONSE_5"], interactive=True, file_count="single", file_types=ALLOWED_EXTENSIONS)
367
+ with gr.Sidebar(open=False):
368
+ model_radio = gr.Radio(show_label=False, choices=MODEL_CHOICES, value=MODEL_CHOICES[0])
369
+ model_radio.change(fn=change_model, inputs=[model_radio], outputs=[user_history, user_session, selected_model, J_A_R_V_I_S])
370
+ msg.submit(fn=respond_async, inputs=[msg, user_history, selected_model, user_session, J_A_R_V_I_S], outputs=[chatbot, msg, user_session], api_name=INTERNAL_AI_GET_SERVER)
 
 
371
  msg.stop(fn=stop_response, inputs=[user_history, user_session], outputs=[chatbot, msg, user_session])
372
  jarvis.queue(default_concurrency_limit=2).launch(max_file_size="1mb")