Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting file upload. #64

Merged
merged 16 commits into from
Aug 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removes unnecessary file.read()
Prevents memory to fill.
  • Loading branch information
Fabio Beranizo committed Aug 11, 2021
commit b541438e8536e999d90065026a6db40dfe9079e2
6 changes: 3 additions & 3 deletions datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import numpy as np
import pandas as pd
import datasets.monkeypatch
import platiagro
from chardet.universaldetector import UniversalDetector
from googleapiclient.discovery import build
Expand All @@ -17,6 +16,8 @@
from pandas.io.common import infer_compression
from platiagro import load_dataset, save_dataset, stat_dataset, update_dataset_metadata
from platiagro.featuretypes import infer_featuretypes, validate_featuretypes

from datasets import monkeypatch # noqa: F401
from datasets.exceptions import BadRequest, NotFound

from datasets.utils import data_pagination
Expand Down Expand Up @@ -91,9 +92,8 @@ def create_dataset(file_object):
}

file.seek(0, SEEK_SET)
contents = BytesIO(file.read())
# uses PlatIAgro SDK to save the dataset
save_dataset(name, contents, metadata=metadata)
save_dataset(name, file, metadata=metadata)

columns = [{"name": col, "featuretype": ftype} for col, ftype in zip(columns, featuretypes)]

Expand Down