Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,12 +38,28 @@ def gradio_interface(file, json_structure):
|
|
| 38 |
return "Please upload an Excel file."
|
| 39 |
return send_excel_to_api(file.name, json_structure)
|
| 40 |
|
| 41 |
-
#
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
"activo a corto plazo": {
|
| 48 |
"valor inventarios - ejercicio 2023": "",
|
| 49 |
"valor inventarios - ejercicio 2022": ""
|
|
@@ -54,12 +70,13 @@ iface = gr.Interface(
|
|
| 54 |
},
|
| 55 |
"perdida_del_ejercicio": "",
|
| 56 |
"rfc": ""
|
| 57 |
-
}'''
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
# Launch the interface
|
| 65 |
-
|
|
|
|
| 38 |
return "Please upload an Excel file."
|
| 39 |
return send_excel_to_api(file.name, json_structure)
|
| 40 |
|
| 41 |
+
# Custom color for the theme
|
| 42 |
+
custom_purple = "#7f56d9"
|
| 43 |
+
|
| 44 |
+
# Create the Gradio interface using Blocks
|
| 45 |
+
with gr.Blocks(theme=gr.themes.Default(primary_hue="purple", secondary_hue="purple")) as demo:
|
| 46 |
+
gr.Markdown(
|
| 47 |
+
"""
|
| 48 |
+
<div style="text-align: center;">
|
| 49 |
+
<img src="https://copilot.nebuia.com/images/logo_white.png" style="max-height: 400px; max-width: 120px; object-fit: contain;">
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
## NebuIA Excel Structure Extractor
|
| 53 |
+
Upload an Excel file and provide a JSON structure to send to the API.
|
| 54 |
+
"""
|
| 55 |
+
)
|
| 56 |
+
with gr.Row():
|
| 57 |
+
file_input = gr.File(label="Upload Excel File")
|
| 58 |
+
json_input = gr.Code(
|
| 59 |
+
label="JSON Structure",
|
| 60 |
+
language="json",
|
| 61 |
+
lines=15,
|
| 62 |
+
value='''{
|
| 63 |
"activo a corto plazo": {
|
| 64 |
"valor inventarios - ejercicio 2023": "",
|
| 65 |
"valor inventarios - ejercicio 2022": ""
|
|
|
|
| 70 |
},
|
| 71 |
"perdida_del_ejercicio": "",
|
| 72 |
"rfc": ""
|
| 73 |
+
}'''
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
output = gr.Textbox(label="API Response", lines=10)
|
| 77 |
+
submit_btn = gr.Button("Submit")
|
| 78 |
+
|
| 79 |
+
submit_btn.click(fn=gradio_interface, inputs=[file_input, json_input], outputs=output)
|
| 80 |
|
| 81 |
# Launch the interface
|
| 82 |
+
demo.launch()
|