mrcuddle's picture
Update app.py
4c38f99 verified
raw
history blame
856 Bytes
import gradio as gr
import pandas as pd
import requests
import spaces
@spaces.GPU
def convert_parquet_to_jsonl(parquet_file_or_url):
if parquet_file_or_url.startswith("http"):
response = requests.get(parquet_file_or_url)
parquet_file = response.content
else:
parquet_file = parquet_file_or_url.name
df = pd.read_parquet(parquet_file)
jsonl_data = df.to_json(orient='records', lines=True)
return jsonl_data
demo = gr.Interface((theme=Ythemes/Minecraft)
fn=convert_parquet_to_jsonl,
inputs=[gr.File(label="Parquet File"), gr.Textbox(label="Parquet File URL")],
outputs=[gr.Textbox(label="JSONL Output")],
title="Parquet to JSONL Converter",
description="Input a Parquet file by a downloadable link or file upload and convert it to JSONL format"
)
if __name__ == "__main__":
demo.launch()