Skip to content

Instantly share code, notes, and snippets.

View omarsar's full-sized avatar
🐙

Elvis Saravia omarsar

🐙
View GitHub Profile
drive_service = google_authenticate()
def read_file(file_id):
"""
Download file from Google Drive
Argument: file_id
Returns: downloaded file
"""
file_id = file_id
import io
text_file = read_file('1NrodQrpaw-9xU2lCYo8H8fiW6A1RGdwt') # file id of the picture
document = text_file.read()
print(len(document))
print(document[0:100])
wordcloud = WordCloud().generate(document)
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
image_file = read_file("1kHhmo4fj5PqhpH2x_hVY6uUDgf2_G0Tn")
# create mask
alice_mask = np.array(Image.open(image_file))
# remove stopwords
stopwords = set(STOPWORDS)
stopwords.add("said")
# generate word cloud
!pip3 install torch torchvision
import torch
import torch.nn as nn
X = torch.tensor(([2, 9], [1, 5], [3, 6]), dtype=torch.float) # 3 X 2 tensor
y = torch.tensor(([92], [100], [89]), dtype=torch.float) # 3 X 1 tensor
xPredicted = torch.tensor(([4, 8]), dtype=torch.float) # 1 X 2 tensor
print(X.size())
print(y.size())