!qLJjOzHulObEaNkomA:matrix.org

Entirety.ai

91 Members
Intuition to Implementation19 Servers

Load older messages


SenderMessageTime
16 Feb 2019
@udipta03:matrix.orgudipta03 joined the room.06:13:42
@entirety:matrix.orgu6yuvihttps://colab.research.google.com/drive/1GeAoLbp0jaqMpK-1FQAp8-N2i5CrxeOY09:10:03
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event09:12:22
@riotkiran:matrix.orgriotkiranThanks Guys09:44:55
@entirety:matrix.orgu6yuvi

#! /usr/bin/env python
from flask import Flask, render_template, request, Response
import numpy as np
from binascii import a2b_base64
import imageio
from PIL import Image
import io
import time
import ast
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms

global model_states, nb_epoch #to have access later
model_states = ['Not Trained']
nb_epoch=5

app = Flask(name)

model =None
#page to_train
@app.route('/')
def to_train():
return render_template('to_train.html', nb_epoch=nb_epoch)

#train the model
@app.route("/loadmodel/", methods=['GET'])
def load():
global model
class NN(nn.Module):
def init(self):
super(NN, self).init()
self.conv1L = nn.Conv2d(1, 20, 3, 1)
self.conv2L = nn.Conv2d(20, 50, 3, 1)
self.FC1 = nn.Linear(5550, 500)
self.FC2 = nn.Linear(500 ,10)

	def forward(self, x):
		x = F.relu(self.conv1L(x)) #20 x 26
		x = F.max_pool2d(x, (2,2)) #20 x 13
		x = F.relu(self.conv2L(x)) #50 x 11
		x = F.max_pool2d(x, (2,2)) #50 x 5x 5
		x = x.view(-1, 50*5*5) #flatten
		x = self.FC1(x) #500
		x = self.FC2(x) #10
		return F.log_softmax(x, dim=1)
checkpoint = torch.load("Meetup_MNIST.pt")
model = NN()
model.load_state_dict(checkpoint)
print("model loaded")
return "Loading done"

#page where you draw the number
@app.route('/index/', methods=['GET','POST'])
def index():
prediction='?'
if request.method == 'POST':

    dataURL = request.get_data()
    drawURL_clean = dataURL[22:]
    binary_data=a2b_base64(drawURL_clean)
    img = Image.open(io.BytesIO(binary_data))
    img.thumbnail((28,28))
    img.save("data_img/draw.png")

return render_template('index.html', prediction=prediction)

#display prediction
@app.route('/result/')
def result():
time.sleep(0.2)
img = Image.open("data_img/draw.png").convert("1")
transform=transforms.Compose([transforms.ToTensor()])
img = transform(img)
img = torch.unsqueeze(img , 0)
prediction = inference(model , img)
print(prediction)
return render_template("index.html",prediction=prediction)

def inference(model , img):
output = model(img)
output = torch.exp(output)
top_prob,top_class=output.topk(1,dim=1)
return top_class.item()

if name == "main":
app.run(debug=True, threaded=True)

09:45:48
@entirety:matrix.orgu6yuviDownload app.py09:48:26
@entirety:matrix.orgu6yuvihttps://docs.google.com/forms/d/e/1FAIpQLSfh4cMOBzV26CUj2QVrVisraW9GwPqJlgj7-UZJghK6MBXHeQ/viewform09:59:26
@gangakrish:matrix.orggangakrish joined the room.15:06:22
17 Feb 2019
@jyothics:matrix.orgjyothics joined the room.07:10:47
@gangakrish:matrix.orggangakrishHi Team08:22:53
@gangakrish:matrix.orggangakrishCould you please send the steps to load the model?08:23:20
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event09:48:01
@riotkiran:matrix.orgriotkiran Hi, once you have recording of yesterday's class, please do share the link and class content as well. I missed last 30 minutes :) Thanks 09:52:16
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event09:53:09
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event09:54:42
18 Feb 2019
@anandgokul18:matrix.organandgokul18Hi guys, looks like the '/image' folder is not uploaded in Session 3. So, can't see any images in the ipynb files03:02:48
@anandgokul18:matrix.organandgokul18Can you add that to the gitlab Session 3 folder? Thanks :D03:04:05
@shwetag:matrix.orgshwetagDo anyone did speech recognition or speech synthesis using pytorch05:16:08
@shwetag:matrix.orgshwetagDo anyone did speech recognition or speech synthesis using pytorch05:16:30
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event11:37:56
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event11:49:39
@amul:matrix.orgamul joined the room.14:58:33
19 Feb 2019
@riotkiran:matrix.orgriotkiran
In reply to @aman5319:matrix.org
obviously
Hi, Is the recording available
16:28:59
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event16:34:01
@lakshmi_narayan:matrix.orglakshmi_narayan left the room.19:50:33
@lakshmi_narayan:matrix.orglakshmi_narayan joined the room.19:51:28
20 Feb 2019
@riotkiran:matrix.orgriotkiran@aman5319:matrix.org: can you share the recording06:06:43
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event06:10:20
@aman5319:matrix.org@aman5319:matrix.orgRedacted or Malformed Event06:11:02
@riotkiran:matrix.orgriotkiranThanks 👍06:23:35

Show newer messages


Back to Room ListRoom Version: 1