-
Notifications
You must be signed in to change notification settings - Fork 0
/
Course_3_Week_4_Project_3.py
28 lines (20 loc) · 1021 Bytes
/
Course_3_Week_4_Project_3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
This is is a part of the DeepLearning.AI TensorFlow Developer Professional Certificate offered on Coursera.
All copyrights belong to them. I am sharing this work here to showcase the projects I have worked on
Course: Introduction to TensorFlow for Artificial Intelligence, Machine Learning, and Deep Learning
Week 4: Sequence models and literature
The full tutorial can be dound here:https://www.tensorflow.org/tutorials/text/text_generation
"""
import tensorflow as tf
from os import getcwd
import numpy as np
import os
import time
from tensorflow.keras import Model
path_to_file = tf.keras.utils.get_file('shakespeare.txt', 'https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt')
# Read, then decode for py2 compat.
text = open(path_to_file, 'rb').read().decode(encoding='utf-8')
# length of text is the number of characters in it
print('Length of text: {} characters'.format(len(text)))
# Take a look at the first 250 characters in text
print(text[:250])