6

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?

2 Answers 2

3

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(...)

Sign up to request clarification or add additional context in comments.

Comments

1

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=" ")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.