 Welcome to my talk, this is postcards from Gorbipuff. Y'all who are in here have decided that you'd rather laugh and learn some things than go to the other talks right now and I approve of that choice. I'm Aja, I'm Thagamizer on GitHub and all the code for this talk is in my examples repo already under RailsConf 16. I tweet at ThagamizerRB, I really like it when people tweet at me during my talks. My phone is somewhere over there so it won't like interfere with the mic or you know interrupt me while I'm talking and it definitely won't pop up, I'm offline. And my blog is Thagamizer.com, the slides for this talk are also up there if you want to follow along on your laptop. And I really like dinosaurs. So I work for a Google Cloud platform. We're going to have a workshop tomorrow afternoon in the workshops track. If you want to check out our stuff, want some time to just work through stuff with some folks who know the platform better sitting around, that's a great way to do it, we'll help you out. We're also going to have a booth, you should totally come by, ask us our questions, get free stuff because that's why people have booths is to give out free stuff. And if you're one of those people who doesn't like actually talking to people face to face, I know there's some of you. Check out our Slack, we have a Ruby room, several of the folks are going to be working the booth and some folks who weren't able to make it to the conference hang out in that room, we can answer questions to get you hooked up. And because I work for a big company, I have to have this slide, laircat says, any code in this talk is copyright Google and licensed Apache V2, oh and by the way if you didn't notice, this is the cat pictures talk, there's probably an equal amount of cat pictures in code. So, okay, so who knows who this is? So that's Gourby, he belongs to this character who also lives in Seattle and is lovely and is giving the keynote on Friday morning I believe and you should totally go to it because it currently contains less pictures of Gorbachev than this talk, I stole them all for this conference. And Gourby was mad that he couldn't come with tender love to RailsConf, so he decided to set off on a world tour of his very own. So in the spirit of 1980s educational software, where in the world is Gourby Puff? He's gonna be leaving us some clues in the form of postcards, so I had an argument with someone, who gets the joke that I'm making here in the computer program that I'm alluding to, raise your hands? Okay, enough of you, that's all I cared about. So first clue, this kind of statue thing and postcard, so here's the back of it, Gourby Puff's hanging out with his new stone friend, tells me the car is a high on iron. So we need to figure out where Gourby is, where's Gourby? And much like in that quintessential 80s computer game, we have access to a super problem solving computer, only ours is called Google and we're gonna be using Google Cloud Vision for this. So Google Cloud Vision is a web API that can label landmarks, faces, does face detection, doesn't tell you who they are, just tells you it's a face. Text, they can also label a large variety of things. I'm gonna go, I'm gonna go, the going's good. And it can all label a large variety of things and images, and it can also find adult content of various sorts, if that is a thing that is relevant to you, either not having or having for whatever your website might be. I'm also gonna be using the G Cloud Gem. If you've tried using Google APIs before with our programmatically generated gem and you had a bad time, I recommend you come back and try G Cloud. This is by Rubius for Rubius, it's hand coded. If you know Mike Moore or Chris Smith who are in Utah, Mike use, Mike ran the Mountain West X conferences. They are the ones who are working on this and they've done a fantastic job, and it really feels natural. So here's the code that you need to look at that postcard from Gourby. I'm gonna walk through it, so we're gonna require the gem. We're gonna be using Vision, so I'm gonna require Cloud Vision. Create a new G Cloud Objects, I'm specifying two arguments here. One is the project, which is just a way of organizing your resources inside Google Cloud, and the other is a private key that lets me authenticate into that project. Partly this is for billing, sadly, Vision is not free. Cloud Vision is not free. I'm gonna create a Vision Object, and then I'm gonna pull an image. And I'm pulling this image off of the local disk, but you could also pull it from a web store of some sort or another. And then this is the line that does all the magic. So I'm calling annotate on the Vision API, passing it the image. And I'm telling it that I wanna find one landmark. Because it really seemed like there was only one in that picture. And if it finds something, I'm gonna print out the description using puts. And I'm also gonna print out the location, which is gonna give me the lat long. Cuz yes, from the picture it can tell you what it is and where it is. So because it's been a while, that's what the image looked like. And this is what comes out. It actually knows that that's the Fremont Troll. The Fremont Troll happens to be about three blocks from the Google Seattle offices. If you've seen the movie Ten Things I Hate About You, you have seen this troll. It plays a fairly large part in that movie. So where in the world is Gorbachev? Gorbachev is right here. So we get in our little virtual 8-bit plane, and we fly. And we get there, and there's a guy sitting around. He says, a grumpy cat gave me something for you. I'm like, well, this grumpy cat? Yeah, yeah, that grumpy cat. And he gave us this postcard. And the guy mentioned to me that he wanted to hang out with this creature. He was very jealous of how not flat its face was. So here's the back of this one. Is it a dog? Is it a rat? It's such a pointy face. Gotta figure out what kind of animal this is to confine me. So we're going to use the label detection in Google Cloud Vision this time. And this can label all sorts of things, like animals, including breeds on dogs and cats, especially if they're pretty distinctive breeds, modes of transportation, types of structures, and all sorts of other really cool stuff. And to give you some examples, those are my cats. This was taken about a week ago. We were hanging out on the deck. And I wanted to run this through Cloud Vision and see what it would label it. And so these are the labels it gave me. It said, those are cats. They're probably pets. One of them is kind of black. Actually, the big thing then is black, and that is the plastic cover on my planters. There are mammals in that picture, which is interstatement. There are animals in that picture. They're probably playing. They are small to medium-sized cats. There's a tabby cat. My cat nick is a tabby. And so on. Cat-like mammal. It was a little less certain on that. And one of the things that it does that I'm not sure and use is that whenever it does any of these labels, it gives you a percentage certainty how confident it is that a given label applies. And it was a little less confident on cat-like mammal. But here's another one, entirely different. This is a picture I took while skiing. And these are the labels it came up with. Snow, mountain, weather, peace, winter, geological phenomenon, season, and adventure. Since it's a double black diamond, I was pretty happy with the label of adventure. And one of the things I wanted to point out is if you look at this picture, we think of snow, and we think of snow as being white. And there's actually very, very little white in this picture because of the way the lighting worked out. But cloud vision, because it uses machine learning techniques, was able to figure out that this was snow. You think of snow, you think of snowmen. So it's really cool that it's that powerful. And in the third example, some buses. And it says, yeah, there's a transport. Not only are they buses, they're double-decker buses. Probably a tour bus service, maybe commercial vehicles. Engine? Yes, there's probably an engine involved in a bus. But I was able to do all this, and I was able to do it with really, really small amounts of code. Specifically, this amount of code. At right there are seven lines, including the require. So it's basically the same setup as before. The only line that changes is this magic line. Instead of asking it to look for landmarks, I'm going to ask it to look for labels. And I want to be clear that I'm using a not fully released version of the library yet. You can grab it off GitHub. It's in public repo. And when they finally integrate it fully into the gem, they're going to make it so all you have to do is say annotate. And it will find all the interesting stuff for you. And then, because I don't have just a single landmark, I'm going to iterate over the labels that it finds, and I'm just going to print them out. So back to that postcard we had, what the heck is it? Some of you probably have a pretty good guess. I'm guessing some of you have no idea what the heck this is. Turns out it's a wombat. And CloudVision was successfully able to identify a wombat. I tried it with a pangolin. If you know what a pangolin is, it thought it was a turtle or an armadillo, which is actually a fair amount of what a pangolin looks like. So I'm not actually all that sad about that. But I figured out a wombat pretty confidently. I believe it was 93% confident that this was a wombat. So getting our 8-bit plane again, we're going to fly to Australia. And we meet someone who says this. And I saw a cat matching that description. He told me to give you this. So here's another postcard from Gorbipuff. This is some sort of sign in some language that I don't currently speak. On the back of it is, it's a tender love lest me elicit countries he likes to visit, and there was a lane around the apartment. Do you have any idea what this sign says? Let's see if we can. So I mentioned the fact that we can do text detection. The technical term for this is optical character recognition. And what this does is it'll find things that are characters in the images, and it'll figure out what character they are. And the really cool thing is it will also figure out what language they are likely in. So same setup as before. Only line that changes instead of looking for labels or landmarks, we look for text. And then we print out the text. And I also want to print out what locale. The idea of a locale is a combination of a language and a place. So countries that have multiple official languages will have multiple official locales. Countries that only have one official language only have one locale. And we'll get that information so we can figure out where Garby has gone off to this time. So here's the picture again. And here's the text that comes back. And it's not great. It's not particularly accurate. OCR is actually really hard, especially off of images. If you have an image that is neatly lined up and you're using Roman characters, there's been a lot more training on those kinds of data sets. And so it tends to work better. But I'm using a non-Western character set here. And you'll notice that the locale came back as JA, which is for Japan, not surprising. Tenderlove likes to go to Japan. He speaks Japanese, not surprising that, you know, Garby would try to figure out where his owner has been going off to all these times. But I don't actually speak Japanese. So let's figure out what I can do with this. So who has used Google Translate? Yeah, who's done the trick where you take a thing and you put it through Google Translate from one language to another to another to another and play like the crazy game of telephone? Yeah, me too. That's awesome. So I'm gonna show you how to do that programmatically now. There's support for Translate in the GCloud gem. And this is all you have to do to run something through Translate, making it a GCloud object, creating a Translate object from that, and then running some Translate text through. I'm gonna point out that the from argument is completely and utterly optional. It can usually guess pretty well just based on the characters. But since I have the locale, I'm gonna throw it in because it will increase the likelihood that my translation is correct. If you've used Translate, you know that it's doing its best. Human language is really, really, really hard problem. And so while it gets really close and you can generally get the gist, sometimes it needs a little bit of help. So this is what comes back from Translate, just the straight out text. And so, you know, it was a bunch of text in that image. This isn't just that sign. There's actually text on some of the buildings and stuff in the background as well that it got pulled in. But I know that Gorby's at a flower garden and he's playing in a beach. And you know, he's a cat, a giant sandbox. This seems to make sense. So let's go catch up with Gorby, see what he's doing. A bit plain. Someone says, the cat you were looking for was here. He's been hitting the books. The best part of this talk was going through Gorby's Tumblr, because he has a Tumblr and a Twitter and he has more Twitter followers than I do. It's actually in my goals for this year. Official company goals is get more Twitter followers than Gorbachev. So he's decided that he's gonna give us some trivia this time. What place on earth have the hottest temperature on, it's actually May 4th, 2000. The slide didn't come out. And this is because Gorby found out that he's not particularly good at Ruby karaoke. So he's gonna go for Ruby pub trivia instead. So there's a cool tool that Google has called BigQuery. I did a talk about this in Mountain West two years ago and it's a tool that we designed internally for processing large quantities of logs. The really cool thing I like about it is it lets you query large data sets with SQL as opposed to all those other databases or tools that use large data sets and you have to learn a special query language for them. Also, it doesn't have any indices. It's like this awesome magic trick. You don't have to spend time indexing your data. It just works, it's so cool. So if you wanna play with it, we've got a bunch of public data sets and the one I like using is GSOD, which stands for Global Surface Conditions of the Day. And it's just a database worth of weather data. It's a couple gigabytes. You can do much bigger data sets. I like this one because it's interesting. Everyone deals with weather. And it's got a huge schema including things like Boolean. Was there thunder on a given day? But since we're trying to figure out what place in the entire world was hottest on May 4th, 2000, we're gonna just use the station number, which identifies the location, the year, month, and day, and then the mean temperature for that day. Makes sense, right? Here's the query. So I don't know how many of y'all know SQL. I guess as you all know enough of it, when I was doing a lot of interviewing, write a SQL query that looked approximately like this was pretty common in one of my questions. I'm like, here, here's a table. Find me the max by blah, blah, blah. And this was a totally acceptable answer. I'm not doing any aggregation, although BigQuery can totally do that and does it very quickly. Just finding the mean temp and ordering by descending. So the top, the first one's gonna be the warmest. So if I run this query, and I'm happy to do this as a demo afterwards, but I'm not gonna touch my laptop because the slides are working right now, is, the query runs in less than 20 seconds. It goes over, I think, seven gigabytes, six gigabytes, something without to do it. And it's cache, so if I run it again, it's instantaneous after that. And remember, no indexes, nothing like that, it just works. This is the first four rows that I get back, and so there's this place that was 102 degrees on May 4th, 2000. And the station number is this. I've used this data set a lot at this point, and so I happen to know that a leading six means it's in Africa. And there's a table that you can look up on the World Meteorological Association website to figure out what these numbers are. And it happens to be that this particular weather station was in Mali. So let's go find ourselves a cat. Meet someone, some shady character's given us a clue. The cat had a ball here. Yep, I made that pun. I stole that one from Tenderlove. And Gordie says we're almost done. Here's the next clue. So, here's our final postcard. Looks like a landmark again. Someone gets the joke, congratulations. The rest of you will get it shortly. I've been enjoying my world tour. Lots of people to meet. Headbutt, you know, Gorby is internet famous. He gets lots of headbutts, belly rubs, all the things. He really likes belly rubs. So let's figure out where he is. So landmark again. Same code as for the first postcard. Turns out it's Kauffman Stadium, right here in Kansas City. So congratulations, we've found Gorby Puff. And also, so this is the sponsored track, and I'm supposed to make fun of myself because I got all of my actual proposals for RailsConf rejected, so I had to speak in the sponsored track. And this talk was inspired by Children's Television from the 80s, and I worked for a company called Alphabet. So this talk today is brought to you by the letters G, C, and P. It stands for Google Cloud Platform. So this is the part where I do the sponsored pitch. So if you have applications, I promise you that we can most likely run them. Yeah, it's a lovely promise right there. I haven't run into anything that we can't run. It may not make sense for us to run it, but that's up for you to decide. I'm happy to talk to you guys. We've got a lovely team of folks over there sitting in the second row mocking me. They're also happy to help you out. We have VMs, we have storage. We have great tools for big data. We have great tools for machine learning now that are coming out. All the stuff is available to Ruby. And if you are one of the five people who actually use containers in production, let's talk, because we've got awesome stuff for container people. And I get to make a special announcement because I got to give the sponsored talk. We are announcing the App Engine for Ruby is in beta. As of today, we're actually officially announcing it tomorrow because today is May the 4th and the internet is full of Star Wars. Let's just be practical about this. So App Engine is our platform as a service product. Some of you may have tried it a couple years ago and were like, we support App Engine for Ruby, but only if you use JRuby. That's not this product. You can actually use MRI. Like the Ruby that you use on your laptop, we will happily run it. We will happily autoscale it. We'll happily take care of loading your logs in if you put the right gems in so you can query them with tools like BigQuery. All that stuff we're happy to do for you on this product. It's really super cool and it launches well and it runs all the stuff that you guys care about. We've got a lot of people who've worked with Ruby for dozens of years at this point working on it. And I'm really happy to be able to get up here and say this. And you can run Sinatra if you don't wanna run Rails because some of you don't wanna run Rails even though you're at RailsConf and I understand. The other thing is if you wanna try to have our APIs gem install gcloud, Mike and Chris have done a fantastic job on this. It's really a much better experience than it was than using some of the other products have been in the past. It just feels more like Ruby. The other stuff worked great, but I would be like, you know, this wasn't actually written by Rubyist, was it? This feels like Ruby. Like the alias the heck out of things. That annotate method has five names. Because you know, it's Ruby. We need to be able to do everything at least three different ways and have that all be right. We're not Python. So I wanna say some thank yous. Aaron Patterson, because I came up with the idea for this talk at work and then I'm like, okay, now I have to get Aaron's permission to use all of his pictures of his cat. He's like, that's the best idea ever. You'll note that he's not in this talk. He's actually seen the slides already. Mike Moore and Chris Smith for the GCloud gem and my lovely coworkers and the other folks who couldn't make it here who worked on GCloud Ruby with me or Google Cloud Ruby support. I've been working at Google for about 18 months and I'm finally glad that I get to talk about something that y'all can use that isn't Docker. It makes me happy. So, photo credits, all Creative Commons by 2.0. And this is the part where I take questions and I am repeating something I started earlier this year. If you ask a question, I'll show you a cat picture. Yes, why should you use Google Cloud Platform over Docker? Why not both? You can use both. So if you don't wanna do the ops work yourself, try out App Engine. If you're like, I know how to set up a VM, try Compute Engine. If you're like, hey, this Docker thing seems awesome. You can try out a Compute Engine. We have stuff to support all three levels of we call it the Compute Continuum because we like big words like that. But we pretty much have something for everyone. The only place where it gets to be an interesting conversation is if a particular competitor or running stuff on premises is more cost effective for you, go nuts. The cloud prices keep dropping. So check us out in another couple months. It might be cheaper then. Sorry, cat picture. This one was named Inchworm. Random useless fact. One of your well-known Rubyists fosters baby kittens and I get to take pictures of them. Yes, back. I did not do it through G-Cloud, but you could. So if you're gonna be doing something from code, so the question was did I do the big query query through G-Cloud or did I do it some other way? So there's a web interface. I actually really like the web interface because I can save things and I can export them to various formats and it just, how many of you guys have built an ad hoc reporting tool for a company you've worked at? Yes, okay, big query can be that ad hoc reporting tool for you, that's one of the lovely things about it. And it's got the web interface so you can change your mind about your queries and explore and do things like that. I know folks who are using it from the G-Cloud gem, from code, because they're doing queries over and over again and they want them to show up on a dashboard. And so they'll be doing it from G-Cloud because they know what the query they want is. Most of the time I'm just doing exploratory stuff so I use the web UI. It works, it's just as fast, it's kind of pretty, has a lot of blue, so yeah. More kittens. This one was that's outrageous orange. Kittens have awesome names. Any other questions? Yes, okay. So what algorithms are behind the vision software? I don't actually know in tons of detail, I know that a good hunk of the idea is neural nets. I know that some of the folks who worked on it also worked on TensorFlow, which is our open source machine learning library that you can download and try out and use for all of your various machine learning problems. But I don't actually have a ton of the details. There are some details available online. And I know that people are working on white papers and deeper talks on the actual machine learning part behind it. One of the things I've found is that I'm like, I have this giant pile of data or I have a lot of this really cool stuff. What do I do? And I've read a bunch of machine learning books and I took the Coursera machine learning class. But I'm like, I could spend my time re-implementing this. I could just grab something that someone else has done and do the cost benefit analysis on it. Which is why I think things like Cloud Vision and we've actually got, what's the talky one? It's been announced. No, speech API. Yeah, there's gonna be one for speech as well soon. Which I've come up with a lot of very weird cool things to do with that. The idea that you could just send an audio file and get the text back is kind of awesome. For an arbitrary corpus of words. Giant pile of kittens, yes. It is not, but the one thing I was supposed to say when I announced GCloud is that more APIs are coming soon. There are at least two people working on it full time. It's completely open source. It's up on GitHub. You can totally look at it. You can enter issues and that's how I got them to add vision. So I'm like, hey, I wanna give a talk on vision. Can you guys please add vision? And then Mike's like, yes, well add vision but it's not gonna be fully integrated by the time you need it. I'm like, okay, that's okay. So I'm working on it. I'm actually working on a branch. But if you look at my code on GitHub under my repo, you'll see the actual in the gem file you'll see where I'm pulling from. Awesome, so we're gonna be hanging out. You wanna talk to us? I also have the cardboard. If you wanna see a 3D tour of one of our data centers, you can totally come over and shove your face up against a pile of cardboard and see a 3D tour of one of our data centers. I know I'm like, it's a data center. It has blinky lights, but it turns out really big data centers are actually really cool even if you think the blinky lights are boring. So thank y'all.