This commit is contained in:
Ben-A-Sabu 2024-05-28 12:05:36 +05:30
parent c464225fa1
commit f1f5e5ffa0

View file

@ -300,6 +300,7 @@ class PrivateGptUi:
gr.components.Button(interactive=True), gr.components.Button(interactive=True),
gr.components.Textbox(self._selected_filename), gr.components.Textbox(self._selected_filename),
] ]
def _build_ui_blocks(self) -> gr.Blocks: def _build_ui_blocks(self) -> gr.Blocks:
logger.debug("Creating the UI blocks") logger.debug("Creating the UI blocks")
with gr.Blocks( with gr.Blocks(
@ -311,6 +312,12 @@ class PrivateGptUi:
with gr.Row(equal_height=False): with gr.Row(equal_height=False):
with gr.Column(scale=3): with gr.Column(scale=3):
HHeader = gr.components.Button(
"Doc Chat",
size="m",
)
mode = gr.Radio( mode = gr.Radio(
MODES, MODES,
label="Mode", label="Mode",
@ -444,18 +451,18 @@ class PrivateGptUi:
with gr.Column(scale=7, elem_id="col"): with gr.Column(scale=7, elem_id="col"):
# Determine the model label based on the value of PGPT_PROFILES # Determine the model label based on the value of PGPT_PROFILES
model_label = get_model_label() # model_label = get_model_label()
if model_label is not None: # if model_label is not None:
label_text = ( # label_text = (
f"LLM: {settings().llm.mode} | Model: {model_label}" # f"LLM: {settings().llm.mode} | Model: {model_label}"
) # )
else: # else:
label_text = f"LLM: {settings().llm.mode}" # label_text = f"LLM: {settings().llm.mode}"
_ = gr.ChatInterface( _ = gr.ChatInterface(
self._chat, self._chat,
chatbot=gr.Chatbot( chatbot=gr.Chatbot(
label=label_text, # label=label_text,
show_copy_button=True, show_copy_button=True,
elem_id="chatbot", elem_id="chatbot",
render=False, render=False,
@ -479,7 +486,6 @@ class PrivateGptUi:
logger.info("Mounting the gradio UI, at path=%s", path) logger.info("Mounting the gradio UI, at path=%s", path)
gr.mount_gradio_app(app, blocks, path=path) gr.mount_gradio_app(app, blocks, path=path)
if __name__ == "__main__": if __name__ == "__main__":
ui = global_injector.get(PrivateGptUi) ui = global_injector.get(PrivateGptUi)
_blocks = ui.get_ui_blocks() _blocks = ui.get_ui_blocks()