Update app.py
Browse files
app.py
CHANGED
|
@@ -127,6 +127,23 @@ def create_interface():
|
|
| 127 |
classification_types_checkboxes = gr.CheckboxGroup(label="Clasificacion Tipo", choices=classification_types_options, interactive = True)
|
| 128 |
|
| 129 |
return output, classification_types_checkboxes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
examples = [
|
| 132 |
[recorte, False, True]
|
|
@@ -138,6 +155,9 @@ def create_interface():
|
|
| 138 |
inputs=[input_text, rag_checkbox, prompt_template],
|
| 139 |
outputs=[output_text, classification_types_checkboxes],
|
| 140 |
examples=examples
|
|
|
|
|
|
|
|
|
|
| 141 |
)
|
| 142 |
|
| 143 |
return iface
|
|
|
|
| 127 |
classification_types_checkboxes = gr.CheckboxGroup(label="Clasificacion Tipo", choices=classification_types_options, interactive = True)
|
| 128 |
|
| 129 |
return output, classification_types_checkboxes
|
| 130 |
+
|
| 131 |
+
# Definimos la funci贸n que se ejecutar谩 cuando se presione el bot贸n de salida
|
| 132 |
+
def mark_checkboxes(output, classification_types_options):
|
| 133 |
+
# Marcamos los checkboxes
|
| 134 |
+
for option in classification_types_options:
|
| 135 |
+
classification_types_checkboxes.set_checkbox_value(optio
|
| 136 |
+
|
| 137 |
+
# Definimos la funci贸n que se ejecutar谩 cuando se presione el bot贸n de salida
|
| 138 |
+
def save_output(output, classification_types_options):
|
| 139 |
+
# Guardamos los resultados
|
| 140 |
+
with open('output.txt', 'w') as f:
|
| 141 |
+
f.write(output)
|
| 142 |
+
# Marcamos los checkboxes
|
| 143 |
+
for option in classification_types_options:
|
| 144 |
+
classification_types_checkboxes.set_checkbox_value(option[0], True)
|
| 145 |
+
|
| 146 |
+
n[0], True)
|
| 147 |
|
| 148 |
examples = [
|
| 149 |
[recorte, False, True]
|
|
|
|
| 155 |
inputs=[input_text, rag_checkbox, prompt_template],
|
| 156 |
outputs=[output_text, classification_types_checkboxes],
|
| 157 |
examples=examples
|
| 158 |
+
live=True,
|
| 159 |
+
fn_on_change=mark_checkboxes,
|
| 160 |
+
fn_on_change=save_output
|
| 161 |
)
|
| 162 |
|
| 163 |
return iface
|