This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| orrect = 0 | |
| total = 0 | |
| with torch.no_grad(): | |
| for data in testset: | |
| data_input, target = data | |
| output = model(data_input.view(-1, 784)) | |
| for idx, i in enumerate(output): | |
| if torch.argmax(i) == target[idx]: | |
| correct += 1 | |
| total += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plt.imshow(X[1].view(28,28)) | |
| plt.show() | |
| print(torch.argmax(model(X[1].view(-1, 784))[0])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from transformers import pipeline | |
| summarization = pipeline("summarization") | |
| original_text = """ | |
| In another experiment, participants would have their brains scanned at the same time as being blindfolded. They would perform various touching tasks while having the brain mapped out. It was noticed that brain reorganization would happen as rapidly as in 40 to 60 minutes! | |
| Considering how quickly the brain reorganizes, it’s suggested that dreams are a defence mechanism. When we go to sleep, our vision cortex finds itself at a disadvantage. If you think about it, it’s the only sense lost — we still hear, taste, feel and smell. It’s unfair. | |
| The brain, to protect the visual cortex from being taken over, creates images and videos internally (the dreams), and we see with our eyes shut. This way, vision is safe. | |
| """ | |
| summary = summarization(original_text)[0]['summary_text'] | |
| print("Summary:", summary) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from transformers import pipeline | |
| summarization = pipeline("summarization") | |
| original_text = """ | |
| The researcher Alvaro Pascual-Leone experimented with measuring exactly that. He wanted to know the speed at which the brain applies such changes. | |
| He blindfolded sighted participants for five days and kept training them at braille. Day after day, the participants would show improvement. | |
| At the end of the five days, their brains were measured in the scanner, and it showed that their occipital cortex (vision) was activated when they were touching objects! | |
| After the blindfold was removed, the brain would come back to its previous state within a day. It was remarkable to see how quickly neural reorganization can happen. | |
| But wait! That’s not all. | |
| In another experiment, participants would have their brains scanned at the same time as being blindfolded. They would perform various touching tasks while having the brain mapped out. It was noticed that brain reorganization would happen as rapidly as in 40 to 60 minutes! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import numpy as np | |
| from neural_network import NeuralNetwork | |
| from flask import Flask, request | |
| import json | |
| model = None | |
| app = Flask(__name__) | |
| def load(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import torch.nn.functional as F | |
| import torchvision | |
| from torchvision import transforms, datasets | |
| import matplotlib.pyplot as plt | |
| import torch.nn as nn | |
| import sys | |
| import json | |
| import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| data = [ | |
| ["01/03/2021", 30, 15, 45, 30], | |
| ["03/03/2021", 41, 10, 51, 40], | |
| ["05/03/2021", 50, 23, 73, 63], | |
| ["07/03/2021", 70, 30, 100, 80] | |
| ] | |
| df = pd.DataFrame(data, columns = ['TRAINING_DAY', 'SHOTS_MADE', 'SHOTS_MISSED', 'TOTAL', 'TRAINING_DURATION (MINs)']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df.to_csv('basketball_training.csv') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if True: | |
| print("OK") | |
| print("Bye") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (true) { | |
| System.out.println("OK") | |
| System.out.println("Bye") | |
| } |