Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeknnDestroy authored and fcakyon committed Jan 23, 2024
1 parent 0855bd5 commit 401024c
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions autollm/serve/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,38 @@ def create_app(openai_api_key, palm_api_key, what_to_make_area, uploaded_files,
progress(0.2, desc="Reading files...")
file_documents = read_files_as_documents(input_files=uploaded_files)

progress(0.4, desc="Updating LLM...")
progress(0.6, desc="Updating LLM...")
custom_llm = create_custom_llm(user_prompt=what_to_make_area, config=config_file)
emoji, name, description, instruction = update_configurations(custom_llm)
emoji, name, description, instructions = update_configurations(custom_llm)

progress(0.8, desc="Configuring app..")
query_engine = AutoQueryEngine.from_defaults(
documents=file_documents,
use_async=False,
system_prompt=instruction,
system_prompt=custom_llm.instructions,
exist_ok=True,
overwrite_existing=True)

# Complete progress
progress(1.0, desc="Completed") # Complete progress bar
create_preview_output = gr.Textbox("App preview created on the right screen.")
create_preview_output = gr.Textbox(
"""LLM details are updated in configuration tab and LLM App is ready to be previewed πŸš€. Start chatting with your custom LLM on the preview πŸ‘‰"""
)

return create_preview_output, emoji, name, description, instruction
return create_preview_output, emoji, name, description, instructions


def update_configurations(custom_llm):
emoji = custom_llm.emoji
name = custom_llm.name
description = custom_llm.description
instruction = custom_llm.instructions
instructions = custom_llm.instructions

return gr.Textbox(emoji), gr.Textbox(name), gr.Textbox(description), gr.Textbox(instruction)
return gr.Textbox(
emoji, interactive=True), gr.Textbox(
name, interactive=True), gr.Textbox(
description, interactive=True), gr.Textbox(
instructions, interactive=True)


def update_app():
Expand Down Expand Up @@ -91,9 +97,12 @@ def predict(message, history):

with gr.Row():
with gr.Column(scale=1, min_width=10):
create_preview_output = gr.Textbox(label="Build preview of the LLM app πŸ‘‰")
placeholder = gr.Button(visible=False, interactive=False)
with gr.Column(scale=1, min_width=100):
create_preview_button = gr.Button("Create Preview", variant="primary")
create_preview_output = gr.Textbox(
label="Status",
info="Click `Create Preview` πŸ‘† to build preview of the LLM app on the right")

with gr.Tab("Configure"):
with gr.Column(variant="compact"):
Expand Down Expand Up @@ -128,6 +137,10 @@ def predict(message, history):
ai_avatar_image = os.path.join(os.path.dirname(__file__), "avatar.jpg")

chatbot = gr.Chatbot(
value=[[
"Who are you?", "I am your custom LLM πŸ€–, enhanced with specialized knowledge."
]],
label="Preview",
bubble_full_width=False,
render=False,
show_copy_button=True,
Expand Down

0 comments on commit 401024c

Please sign in to comment.