Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,14 @@ import requests
|
|
4 |
import spaces
|
5 |
|
6 |
@spaces.GPU
|
7 |
-
def convert_parquet_to_jsonl(
|
8 |
-
if
|
9 |
-
|
10 |
-
|
|
|
|
|
11 |
else:
|
12 |
-
parquet_file
|
13 |
-
df = pd.read_parquet(parquet_file)
|
14 |
jsonl_data = df.to_json(orient='records', lines=True)
|
15 |
return jsonl_data
|
16 |
|
|
|
4 |
import spaces
|
5 |
|
6 |
@spaces.GPU
|
7 |
+
def convert_parquet_to_jsonl(parquet_file=None, parquet_url=None):
|
8 |
+
if parquet_file is not None:
|
9 |
+
df = pd.read_parquet(parquet_file.name)
|
10 |
+
elif parquet_url is not None:
|
11 |
+
response = requests.get(parquet_url)
|
12 |
+
df = pd.read_parquet(response.content)
|
13 |
else:
|
14 |
+
raise ValueError("Either parquet_file or parquet_url must be provided")
|
|
|
15 |
jsonl_data = df.to_json(orient='records', lines=True)
|
16 |
return jsonl_data
|
17 |
|