So I started working with Keras and I was trying out the lstm_text_generation
from the examples. The problem is that have a text file on local directory but the get_file
method has a origin
parameter which requires a file which is hosted somewhere.
I wanted to know if a local file can be used or I have to host the file online?
The purpose of get_file
is downloading a file over the network.
If you want to access something on your file system, you don't need it.
In the case of the text generator, just use something like:
text = open("localfile.txt").read().lower()
and delete the line with path = get_line(...)
If I have to read from a file (someDataFile.txt
) into a numpy array X_train
(to be used in some task by a Keras model) then I can do so like this -
X_train = np.genfromtxt(r"C:\Users\tauseef\Desktop\keras\tutorials\features\someDataFile.txt",delimiter=" ")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With