albertvillanova HF staff commited on
Commit
662ed4b
1 Parent(s): 611a3ed

Fix loading Details with documents containing end of lines

Browse files
Files changed (1) hide show
  1. src/hub.py +3 -1
src/hub.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import json
2
 
3
  import httpx
@@ -17,7 +18,8 @@ async def load_file(path):
17
  async def load_details_file(path):
18
  url = to_url(path)
19
  r = await client.get(url, headers=build_hf_headers())
20
- return [json.loads(line) for line in r.text.splitlines()]
 
21
 
22
 
23
  def to_url(path):
 
1
+ import io
2
  import json
3
 
4
  import httpx
 
18
  async def load_details_file(path):
19
  url = to_url(path)
20
  r = await client.get(url, headers=build_hf_headers())
21
+ f = io.StringIO(r.text)
22
+ return [json.loads(line) for line in f]
23
 
24
 
25
  def to_url(path):