v2p3
Browse files
app.py
CHANGED
@@ -69,9 +69,8 @@ with gr.Blocks(title="3D Embedding Comparison") as iface:
|
|
69 |
with gr.Row():
|
70 |
with gr.Column(scale=1):
|
71 |
string_inputs = gr.State([""])
|
72 |
-
textboxes = gr.Textbox.update(visible=True, label="Text 1")
|
73 |
with gr.Column(variant="panel") as textbox_container:
|
74 |
-
|
75 |
add_button = gr.Button("Add String")
|
76 |
remove_button = gr.Button("Remove String")
|
77 |
|
@@ -89,30 +88,29 @@ with gr.Blocks(title="3D Embedding Comparison") as iface:
|
|
89 |
add_button.click(
|
90 |
add_string,
|
91 |
inputs=[string_inputs],
|
92 |
-
outputs=[string_inputs]
|
93 |
-
then=lambda: update_textboxes(string_inputs.value)
|
94 |
).then(
|
95 |
-
|
96 |
-
|
97 |
-
textbox_container
|
98 |
)
|
99 |
|
100 |
remove_button.click(
|
101 |
remove_string,
|
102 |
inputs=[string_inputs],
|
103 |
-
outputs=[string_inputs]
|
104 |
-
then=lambda: update_textboxes(string_inputs.value)
|
105 |
).then(
|
106 |
-
|
107 |
-
|
108 |
-
textbox_container
|
109 |
)
|
110 |
|
|
|
|
|
|
|
|
|
111 |
submit_button.click(
|
112 |
-
|
113 |
-
inputs=[string_inputs],
|
114 |
-
outputs=[string_inputs],
|
115 |
-
then=lambda x: compare_embeddings(x),
|
116 |
inputs=[string_inputs],
|
117 |
outputs=[plot_output]
|
118 |
)
|
|
|
69 |
with gr.Row():
|
70 |
with gr.Column(scale=1):
|
71 |
string_inputs = gr.State([""])
|
|
|
72 |
with gr.Column(variant="panel") as textbox_container:
|
73 |
+
textboxes = gr.Textbox(label="Text 1")
|
74 |
add_button = gr.Button("Add String")
|
75 |
remove_button = gr.Button("Remove String")
|
76 |
|
|
|
88 |
add_button.click(
|
89 |
add_string,
|
90 |
inputs=[string_inputs],
|
91 |
+
outputs=[string_inputs]
|
|
|
92 |
).then(
|
93 |
+
update_textboxes,
|
94 |
+
inputs=[string_inputs],
|
95 |
+
outputs=[textbox_container]
|
96 |
)
|
97 |
|
98 |
remove_button.click(
|
99 |
remove_string,
|
100 |
inputs=[string_inputs],
|
101 |
+
outputs=[string_inputs]
|
|
|
102 |
).then(
|
103 |
+
update_textboxes,
|
104 |
+
inputs=[string_inputs],
|
105 |
+
outputs=[textbox_container]
|
106 |
)
|
107 |
|
108 |
+
def process_and_compare(strings):
|
109 |
+
processed_strings = [t.strip() for t in strings if t.strip()]
|
110 |
+
return compare_embeddings(processed_strings)
|
111 |
+
|
112 |
submit_button.click(
|
113 |
+
process_and_compare,
|
|
|
|
|
|
|
114 |
inputs=[string_inputs],
|
115 |
outputs=[plot_output]
|
116 |
)
|