Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -768,7 +768,12 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
|
768 |
# Chat interface
|
769 |
with gr.Row(elem_classes="container"):
|
770 |
with gr.Column(scale=2, min_width=600):
|
771 |
-
chatbot = gr.Chatbot(
|
|
|
|
|
|
|
|
|
|
|
772 |
with gr.Row():
|
773 |
msg = gr.Textbox(
|
774 |
show_label=False,
|
@@ -799,6 +804,15 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
|
799 |
)
|
800 |
|
801 |
# Event Handlers for Excel processing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
excel_upload_button.click(
|
803 |
lambda x: ("excel", x),
|
804 |
inputs=[excel_file],
|
@@ -808,11 +822,8 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
|
808 |
inputs=[excel_file],
|
809 |
outputs=[current_session_id, file_status, excel_state]
|
810 |
).then(
|
811 |
-
|
812 |
-
|
813 |
-
f"**Excel Statistics:**\nSheets: {sheets}\nTotal Rows: {rows}"
|
814 |
-
),
|
815 |
-
inputs=[excel_state["data_preview"], excel_state["total_sheets"], excel_state["total_rows"]],
|
816 |
outputs=[excel_preview, excel_stats]
|
817 |
)
|
818 |
|
|
|
768 |
# Chat interface
|
769 |
with gr.Row(elem_classes="container"):
|
770 |
with gr.Column(scale=2, min_width=600):
|
771 |
+
chatbot = gr.Chatbot(
|
772 |
+
height=400,
|
773 |
+
show_copy_button=True,
|
774 |
+
elem_classes="chat-container",
|
775 |
+
type="messages" # Use the new messages format
|
776 |
+
)
|
777 |
with gr.Row():
|
778 |
msg = gr.Textbox(
|
779 |
show_label=False,
|
|
|
804 |
)
|
805 |
|
806 |
# Event Handlers for Excel processing
|
807 |
+
def update_excel_preview(state):
|
808 |
+
if not state:
|
809 |
+
return "", "No Excel file uploaded yet"
|
810 |
+
preview = state.get("data_preview", "")
|
811 |
+
sheets = state.get("total_sheets", 0)
|
812 |
+
rows = state.get("total_rows", 0)
|
813 |
+
stats = f"**Excel Statistics:**\nSheets: {sheets}\nTotal Rows: {rows}"
|
814 |
+
return preview, stats
|
815 |
+
|
816 |
excel_upload_button.click(
|
817 |
lambda x: ("excel", x),
|
818 |
inputs=[excel_file],
|
|
|
822 |
inputs=[excel_file],
|
823 |
outputs=[current_session_id, file_status, excel_state]
|
824 |
).then(
|
825 |
+
update_excel_preview,
|
826 |
+
inputs=[excel_state],
|
|
|
|
|
|
|
827 |
outputs=[excel_preview, excel_stats]
|
828 |
)
|
829 |
|