!qLJjOzHulObEaNkomA:matrix.org

Entirety.ai

53 Members
Intuition to Implementation1 Servers

Load older messages


Timestamp Message
16 Feb 2019
06:13:42@udipta03:matrix.orgudipta03 joined the room.
09:10:03@entirety:matrix.orgu6yuvihttps://colab.research.google.com/drive/1GeAoLbp0jaqMpK-1FQAp8-N2i5CrxeOY
09:12:22@aman5319:matrix.orgaman5319 https://drive.google.com/open?id=124uvXCMo7zHbnfo9MoelqRjvcIG3K4Gd
09:44:55@riotkiran:matrix.orgriotkiranThanks Guys
09:45:48@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:48:26@entirety:matrix.orgu6yuviapp.py
app.py
m.file
09:59:26@entirety:matrix.orgu6yuvihttps://docs.google.com/forms/d/e/1FAIpQLSfh4cMOBzV26CUj2QVrVisraW9GwPqJlgj7-UZJghK6MBXHeQ/viewform
15:06:22@gangakrish:matrix.orggangakrish joined the room.
17 Feb 2019
07:10:47@jyothics:matrix.orgjyothics joined the room.
08:22:53@gangakrish:matrix.orggangakrishHi Team
08:23:20@gangakrish:matrix.orggangakrishCould you please send the steps to load the model?
09:48:01@aman5319:matrix.orgaman5319yeah sure, https://pytorch.org/tutorials/beginner/saving_loading_models.html
09:52:16@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:53:09@aman5319:matrix.orgaman5319Redacted or Malformed Event
09:54:42@aman5319:matrix.orgaman5319
In reply to @riotkiran:matrix.org
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
obviously
18 Feb 2019
03:02:48@anandgokul18:matrix.organandgokul18Hi guys, looks like the '/image' folder is not uploaded in Session 3. So, can't see any images in the ipynb files
03:04:05@anandgokul18:matrix.organandgokul18Can you add that to the gitlab Session 3 folder? Thanks :D
05:16:08@shwetag:matrix.orgshwetagDo anyone did speech recognition or speech synthesis using pytorch
05:16:30@shwetag:matrix.orgshwetagDo anyone did speech recognition or speech synthesis using pytorch
11:37:56@aman5319:matrix.orgaman5319https://gitlab.com/entirety.ai/meetup-intuition-to-implementation Session 3 content has been updated
11:49:39@aman5319:matrix.orgaman5319you can also run the flask app and a short flask introduction md has been added
14:58:33@amul:matrix.orgamul joined the room.
19 Feb 2019
16:28:59@riotkiran:matrix.orgriotkiran
In reply to @aman5319:matrix.org
obviously
Hi, Is the recording available
16:34:01@aman5319:matrix.orgaman5319Yep
19:50:33@lakshmi_narayan:matrix.orglakshmi_narayan left the room.
19:51:28@lakshmi_narayan:matrix.orglakshmi_narayan joined the room.
20 Feb 2019
06:06:43@riotkiran:matrix.orgriotkiran@aman5319:matrix.org: can you share the recording
06:10:20@aman5319:matrix.orgaman5319 https://www.meetup.com/Entirety-ai-Intuition-to-Implementation/events/259095493/
06:11:02@aman5319:matrix.orgaman5319
In reply to @riotkiran:matrix.org
@aman5319:matrix.org: can you share the recording
It is in session 4 meetup page
06:23:35@riotkiran:matrix.orgriotkiranThanks 👍

There are no newer messages yet.


Back to Room List