Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -101,6 +101,24 @@ def health():
|
|
| 101 |
return {"status": "ok", "hf_token": token_status, "token_len": token_len}
|
| 102 |
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
@app.get("/rows/{config}")
|
| 105 |
def get_rows(
|
| 106 |
config: str,
|
|
|
|
| 101 |
return {"status": "ok", "hf_token": token_status, "token_len": token_len}
|
| 102 |
|
| 103 |
|
| 104 |
+
@app.get("/test-download")
|
| 105 |
+
def test_download():
|
| 106 |
+
"""Test downloading a parquet file."""
|
| 107 |
+
from huggingface_hub import hf_hub_download
|
| 108 |
+
try:
|
| 109 |
+
local_path = hf_hub_download(
|
| 110 |
+
repo_id=DATASET_ID,
|
| 111 |
+
filename="data/courts/courts-00000.parquet",
|
| 112 |
+
repo_type="dataset",
|
| 113 |
+
token=HF_TOKEN
|
| 114 |
+
)
|
| 115 |
+
import os
|
| 116 |
+
size = os.path.getsize(local_path)
|
| 117 |
+
return {"status": "ok", "path": local_path, "size_bytes": size}
|
| 118 |
+
except Exception as e:
|
| 119 |
+
return {"status": "error", "error": str(e), "type": type(e).__name__}
|
| 120 |
+
|
| 121 |
+
|
| 122 |
@app.get("/rows/{config}")
|
| 123 |
def get_rows(
|
| 124 |
config: str,
|