@@ -22,32 +22,38 @@ def create_app(openai_api_key, palm_api_key, what_to_make_area, uploaded_files,
2222 progress (0.2 , desc = "Reading files..." )
2323 file_documents = read_files_as_documents (input_files = uploaded_files )
2424
25- progress (0.4 , desc = "Updating LLM..." )
25+ progress (0.6 , desc = "Updating LLM..." )
2626 custom_llm = create_custom_llm (user_prompt = what_to_make_area , config = config_file )
27- emoji , name , description , instruction = update_configurations (custom_llm )
27+ emoji , name , description , instructions = update_configurations (custom_llm )
2828
2929 progress (0.8 , desc = "Configuring app.." )
3030 query_engine = AutoQueryEngine .from_defaults (
3131 documents = file_documents ,
3232 use_async = False ,
33- system_prompt = instruction ,
33+ system_prompt = custom_llm . instructions ,
3434 exist_ok = True ,
3535 overwrite_existing = True )
3636
3737 # Complete progress
3838 progress (1.0 , desc = "Completed" ) # Complete progress bar
39- create_preview_output = gr .Textbox ("App preview created on the right screen." )
39+ create_preview_output = gr .Textbox (
40+ """LLM details are updated in configuration tab and LLM App is ready to be previewed 🚀. Start chatting with your custom LLM on the preview 👉"""
41+ )
4042
41- return create_preview_output , emoji , name , description , instruction
43+ return create_preview_output , emoji , name , description , instructions
4244
4345
4446def update_configurations (custom_llm ):
4547 emoji = custom_llm .emoji
4648 name = custom_llm .name
4749 description = custom_llm .description
48- instruction = custom_llm .instructions
50+ instructions = custom_llm .instructions
4951
50- return gr .Textbox (emoji ), gr .Textbox (name ), gr .Textbox (description ), gr .Textbox (instruction )
52+ return gr .Textbox (
53+ emoji , interactive = True ), gr .Textbox (
54+ name , interactive = True ), gr .Textbox (
55+ description , interactive = True ), gr .Textbox (
56+ instructions , interactive = True )
5157
5258
5359def update_app ():
@@ -91,9 +97,12 @@ def predict(message, history):
9197
9298 with gr .Row ():
9399 with gr .Column (scale = 1 , min_width = 10 ):
94- create_preview_output = gr .Textbox ( label = "Build preview of the LLM app 👉" )
100+ placeholder = gr .Button ( visible = False , interactive = False )
95101 with gr .Column (scale = 1 , min_width = 100 ):
96102 create_preview_button = gr .Button ("Create Preview" , variant = "primary" )
103+ create_preview_output = gr .Textbox (
104+ label = "Status" ,
105+ info = "Click `Create Preview` 👆 to build preview of the LLM app on the right" )
97106
98107 with gr .Tab ("Configure" ):
99108 with gr .Column (variant = "compact" ):
@@ -128,6 +137,10 @@ def predict(message, history):
128137 ai_avatar_image = os .path .join (os .path .dirname (__file__ ), "avatar.jpg" )
129138
130139 chatbot = gr .Chatbot (
140+ value = [[
141+ "Who are you?" , "I am your custom LLM 🤖, enhanced with specialized knowledge."
142+ ]],
143+ label = "Preview" ,
131144 bubble_full_width = False ,
132145 render = False ,
133146 show_copy_button = True ,
0 commit comments