Spaces:
Sleeping
Sleeping
Update ui.py
Browse files
ui.py
CHANGED
@@ -16,7 +16,6 @@ def get_theme():
|
|
16 |
def load_images():
|
17 |
image_carousel_data = {
|
18 |
"NASA": [
|
19 |
-
{"image": "images/rld0.png", "description": "NASA"},
|
20 |
{"image": "images/rld1.png", "description": "NASA"},
|
21 |
{"image": "images/rld2.png", "description": "NASA"},
|
22 |
],
|
@@ -29,7 +28,7 @@ def build_interface(process_input, send_preset_question, update_image):
|
|
29 |
theme = get_theme()
|
30 |
image_carousel_data = load_images()
|
31 |
|
32 |
-
with gr.Blocks(theme=
|
33 |
with gr.Row():
|
34 |
with gr.Column(scale=0.8):
|
35 |
# Add the video
|
@@ -80,7 +79,8 @@ def build_interface(process_input, send_preset_question, update_image):
|
|
80 |
)
|
81 |
|
82 |
with gr.Column(scale=1):
|
83 |
-
|
|
|
84 |
|
85 |
# Define processing functions
|
86 |
def on_submit(message, history, selected_option, similarity_threshold, system_prompt, max_length):
|
@@ -91,17 +91,10 @@ def build_interface(process_input, send_preset_question, update_image):
|
|
91 |
|
92 |
# Configure click events for the chatbot
|
93 |
submit_button.click(
|
94 |
-
|
95 |
inputs=[chatbot_input, chatbot_history, selection, similarity_threshold_slider, system_prompt_input, max_length_slider],
|
96 |
-
outputs=[chatbot_output, chatbot_history,
|
97 |
)
|
|
|
98 |
|
99 |
-
|
100 |
-
preset_question = gr.Button("Pregunta Predefinida")
|
101 |
-
preset_question.click(
|
102 |
-
fn=send_preset_question,
|
103 |
-
inputs=[preset_question, chatbot_history, selection, similarity_threshold_slider, system_prompt_input, max_length_slider],
|
104 |
-
outputs=[chatbot_output, chatbot_history, image_output]
|
105 |
-
)
|
106 |
-
|
107 |
-
return demo
|
|
|
16 |
def load_images():
|
17 |
image_carousel_data = {
|
18 |
"NASA": [
|
|
|
19 |
{"image": "images/rld1.png", "description": "NASA"},
|
20 |
{"image": "images/rld2.png", "description": "NASA"},
|
21 |
],
|
|
|
28 |
theme = get_theme()
|
29 |
image_carousel_data = load_images()
|
30 |
|
31 |
+
with gr.Blocks(theme='upsatwal/mlsc_tiet') as demo:
|
32 |
with gr.Row():
|
33 |
with gr.Column(scale=0.8):
|
34 |
# Add the video
|
|
|
79 |
)
|
80 |
|
81 |
with gr.Column(scale=1):
|
82 |
+
image_url = gr.State(value=None)
|
83 |
+
image_output = gr.Image(label="Imagen asociada")
|
84 |
|
85 |
# Define processing functions
|
86 |
def on_submit(message, history, selected_option, similarity_threshold, system_prompt, max_length):
|
|
|
91 |
|
92 |
# Configure click events for the chatbot
|
93 |
submit_button.click(
|
94 |
+
on_submit,
|
95 |
inputs=[chatbot_input, chatbot_history, selection, similarity_threshold_slider, system_prompt_input, max_length_slider],
|
96 |
+
outputs=[chatbot_output, chatbot_history, image_url]
|
97 |
)
|
98 |
+
image_url.change(fn=update_image, inputs=image_url, outputs=image_output)
|
99 |
|
100 |
+
return demo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|