@@ -22,32 +22,38 @@ def create_app(openai_api_key, palm_api_key, what_to_make_area, uploaded_files,
22
22
progress (0.2 , desc = "Reading files..." )
23
23
file_documents = read_files_as_documents (input_files = uploaded_files )
24
24
25
- progress (0.4 , desc = "Updating LLM..." )
25
+ progress (0.6 , desc = "Updating LLM..." )
26
26
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 )
28
28
29
29
progress (0.8 , desc = "Configuring app.." )
30
30
query_engine = AutoQueryEngine .from_defaults (
31
31
documents = file_documents ,
32
32
use_async = False ,
33
- system_prompt = instruction ,
33
+ system_prompt = custom_llm . instructions ,
34
34
exist_ok = True ,
35
35
overwrite_existing = True )
36
36
37
37
# Complete progress
38
38
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
+ )
40
42
41
- return create_preview_output , emoji , name , description , instruction
43
+ return create_preview_output , emoji , name , description , instructions
42
44
43
45
44
46
def update_configurations (custom_llm ):
45
47
emoji = custom_llm .emoji
46
48
name = custom_llm .name
47
49
description = custom_llm .description
48
- instruction = custom_llm .instructions
50
+ instructions = custom_llm .instructions
49
51
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 )
51
57
52
58
53
59
def update_app ():
@@ -91,9 +97,12 @@ def predict(message, history):
91
97
92
98
with gr .Row ():
93
99
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 )
95
101
with gr .Column (scale = 1 , min_width = 100 ):
96
102
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" )
97
106
98
107
with gr .Tab ("Configure" ):
99
108
with gr .Column (variant = "compact" ):
@@ -128,6 +137,10 @@ def predict(message, history):
128
137
ai_avatar_image = os .path .join (os .path .dirname (__file__ ), "avatar.jpg" )
129
138
130
139
chatbot = gr .Chatbot (
140
+ value = [[
141
+ "Who are you?" , "I am your custom LLM 🤖, enhanced with specialized knowledge."
142
+ ]],
143
+ label = "Preview" ,
131
144
bubble_full_width = False ,
132
145
render = False ,
133
146
show_copy_button = True ,
0 commit comments