import gradio as gr import pandas as pd import openpyxl def upload_excel(file): try: df = pd.read_excel(file.name) return df.to_html(index=False) except Exception as e: return f"Error: {str(e)}" def process_excel(file): return "Processing complete! This is a placeholder message." def display_output(): return "Displaying output! This is a placeholder message." def launch(): with gr.Blocks(css=".upload-button { width: 100%; } .process-button { width: 100%; }") as demo: gr.Markdown("

Excel Processor App

") with gr.Row(): with gr.Column(): gr.Markdown("## Upload Excel File") file_input = gr.File(label="") upload_button = gr.Button("Upload", elem_id="upload-button") excel_output = gr.HTML(label="Excel Content") with gr.Column(): gr.Markdown("## Process and Output") process_button = gr.Button("Process", elem_id="process-button") text_output = gr.Textbox(label="Output", interactive=False) upload_button.click(upload_excel, inputs=file_input, outputs=excel_output) process_button.click(process_excel, inputs=file_input, outputs=text_output) process_button.click(display_output, inputs=None, outputs=text_output) demo.launch() if __name__ == "__main__": launch()