import gradio as gr import pandas as pd import pyarrow as pa import pyarrow.parquet as pq import tempfile css = ''' .gradio-container{max-width: 950px !important} h1{text-align:center} ''' DESCRIPTIONz= """## CSV to Parquet 📂 """ def csv_to_parquet(file): df = pd.read_csv(file.name) table = pa.Table.from_pandas(df) with tempfile.NamedTemporaryFile(delete=False, suffix=".parquet") as tmp_file: pq.write_table(table, tmp_file) parquet_file_path = tmp_file.name return parquet_file_path with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo: gr.Markdown(DESCRIPTIONz) with gr.Row(): csv_input = gr.File(label="Upload CSV File", type="filepath", file_types=["text/csv"]) download_button = gr.File(label="Download Parquet File", interactive=False) convert_button = gr.Button("Convert CSV to Parquet") convert_button.click(fn=csv_to_parquet, inputs=[csv_input], outputs=[download_button]) gr.Markdown("📌 The speed of converting a CSV file to a .parquet file depends on the size and complexity of the CSV file.") demo.launch()