Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e98491e

Browse files
Matthew InkawhichJoelMarcey
authored andcommitted
Temporarily removed caffe2 onnx tutorial; load iris.data file into data folder in introduction to hybrid frontend tutorial
1 parent 7a32b02 commit e98491e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

beginner_source/hybrid_frontend/introduction_to_hybrid_frontend_tutorial.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,19 @@
183183
#
184184

185185
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data" # url to data
186-
filename = url.split("/")[-1]
186+
filename = os.path.join("data", url.split("/")[-1])
187187

188188
# Download file if it doesn't already exist
189189
if not os.path.exists(filename):
190+
os.makedirs("data")
190191
print("Downloading...")
191-
wget.download(url, 'iris.data')
192+
wget.download(url, filename)
192193
print("Download complete!")
193194
else:
194195
print("File exists, skipping download.")
195196

196197
# Print 10 random lines
197-
with open(filename, 'rb') as datafile:
198+
with open(filename, 'r') as datafile:
198199
lines = datafile.readlines()
199200
# Last line in file is empty, we'll deal with this later
200201
lines = lines[:-1]
@@ -218,7 +219,7 @@
218219

219220
# Takes a filename with comma separated contents, returns dataset list
220221
def create_dataset(filepath):
221-
with open(filepath, 'rb') as datafile:
222+
with open(filepath, 'r') as datafile:
222223
# Create dataset list
223224
lines = csv.reader(datafile)
224225
dataset = list(lines)
@@ -233,7 +234,7 @@ def create_dataset(filepath):
233234

234235

235236
# Load dataset
236-
dataset = create_dataset("iris.data")
237+
dataset = create_dataset("data/iris.data")
237238

238239

239240
######################################################################

0 commit comments

Comments
 (0)