Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,12 +15,19 @@ def convert_parquet_to_jsonl(parquet_file=None, parquet_url=None):
|
|
| 15 |
jsonl_data = df.to_json(orient='records', lines=True)
|
| 16 |
return jsonl_data
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
theme = "Ytheme/Minecraft"
|
| 19 |
|
| 20 |
demo = gr.Interface(theme=theme,
|
| 21 |
fn=convert_parquet_to_jsonl,
|
| 22 |
inputs=[gr.File(label="Parquet File"), gr.Textbox(label="Parquet File URL")],
|
| 23 |
-
|
| 24 |
title="Parquet to JSONL Converter",
|
| 25 |
description="Input a Parquet file by a downloadable link or file upload and convert it to JSONL format"
|
| 26 |
)
|
|
|
|
| 15 |
jsonl_data = df.to_json(orient='records', lines=True)
|
| 16 |
return jsonl_data
|
| 17 |
|
| 18 |
+
def main(url):
|
| 19 |
+
parquet_file = download_file(url)
|
| 20 |
+
jsonl_data = convert_parquet_to_jsonl(parquet_file)
|
| 21 |
+
with open("output.jsonl", "w") as f:
|
| 22 |
+
f.write(jsonl_data)
|
| 23 |
+
return "output.jsonl"
|
| 24 |
+
|
| 25 |
theme = "Ytheme/Minecraft"
|
| 26 |
|
| 27 |
demo = gr.Interface(theme=theme,
|
| 28 |
fn=convert_parquet_to_jsonl,
|
| 29 |
inputs=[gr.File(label="Parquet File"), gr.Textbox(label="Parquet File URL")],
|
| 30 |
+
outputs=[gr.File(label="JSONL Output")],
|
| 31 |
title="Parquet to JSONL Converter",
|
| 32 |
description="Input a Parquet file by a downloadable link or file upload and convert it to JSONL format"
|
| 33 |
)
|