Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ embed_models = [
|
|
26 |
"BAAI/bge-large-en"
|
27 |
]
|
28 |
|
29 |
-
# Global
|
30 |
selected_llm_model_name = llm_models[0]
|
31 |
selected_embed_model_name = embed_models[0]
|
32 |
vector_index = None
|
@@ -114,6 +114,7 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]),
|
|
114 |
clear = gr.ClearButton()
|
115 |
output = gr.Text(label='Vector Index')
|
116 |
llm_model_dropdown = gr.Dropdown(llm_models, label="Step-3: Select LLM", interactive=True)
|
|
|
117 |
with gr.Column(scale=3):
|
118 |
gr.ChatInterface(
|
119 |
fn=respond,
|
@@ -122,9 +123,11 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]),
|
|
122 |
textbox=gr.Textbox(placeholder="Step-4: Ask me questions on the uploaded document!", container=False)
|
123 |
)
|
124 |
gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
|
125 |
-
|
|
|
|
|
126 |
btn.click(fn=load_files, inputs=[file_input, embed_model_dropdown], outputs=output)
|
127 |
clear.click(lambda: [None] * 3, outputs=[file_input, embed_model_dropdown, output])
|
128 |
|
129 |
if __name__ == "__main__":
|
130 |
-
demo.launch(share=True)
|
|
|
26 |
"BAAI/bge-large-en"
|
27 |
]
|
28 |
|
29 |
+
# Global variables
|
30 |
selected_llm_model_name = llm_models[0]
|
31 |
selected_embed_model_name = embed_models[0]
|
32 |
vector_index = None
|
|
|
114 |
clear = gr.ClearButton()
|
115 |
output = gr.Text(label='Vector Index')
|
116 |
llm_model_dropdown = gr.Dropdown(llm_models, label="Step-3: Select LLM", interactive=True)
|
117 |
+
model_selected_output = gr.Text(label="Model selected") # FIXED OUTPUT COMPONENT
|
118 |
with gr.Column(scale=3):
|
119 |
gr.ChatInterface(
|
120 |
fn=respond,
|
|
|
123 |
textbox=gr.Textbox(placeholder="Step-4: Ask me questions on the uploaded document!", container=False)
|
124 |
)
|
125 |
gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
|
126 |
+
|
127 |
+
# Event bindings
|
128 |
+
llm_model_dropdown.change(fn=set_llm_model, inputs=llm_model_dropdown, outputs=model_selected_output)
|
129 |
btn.click(fn=load_files, inputs=[file_input, embed_model_dropdown], outputs=output)
|
130 |
clear.click(lambda: [None] * 3, outputs=[file_input, embed_model_dropdown, output])
|
131 |
|
132 |
if __name__ == "__main__":
|
133 |
+
demo.launch(share=True)
|