Shadowing Practice: How I deploy serverless containers for free - Learn English Speaking with Video

Kies een oefenmodus

Elke modus opent een volledig scherm oefenruimte.

78 zinnen
Als zinnen te kort of te lang zijn, klik op Bewerken om ze aan te passen.
1
One of the most annoying things in the world is when you're trying to steal an image from the internet, and it looks like it's going to have a transparent background, but when you download it, it looks like this.
2
Luckily, nowadays there are all kinds of good tools for removing backgrounds from images, like RemoveBG or the new AI tools in Photoshop.
3
Now if you watch my videos, you'll notice I use a lot of images with the background removed, and it's extremely inefficient to have to go into Photoshop, upload an image, remove its background,
4
and then re-export it and bring it back into Adobe Premiere.
5
As a developer, this inefficiency is totally unacceptable, and my only option was to build my own app from scratch.
6
In today's video, I want to show you how I built this background remover from scratch, but more importantly, I want to talk about why I dockerized it, and explain how I deployed it to the cloud for free.
7
Earlier this week on the main channel, I made a Docker video, which you should definitely check out first if you have no idea what Docker is, but that video was sponsored by Docker.
8
This video is not sponsored.
9
I don't work with sponsors very often, but when I do, it's usually with tools that I have first-hand experience with, and Docker is something I use all the time.
10
By containerizing this background remover, which is just a Python web app, I'm able to run it locally with the click of a button, and also deploy it to the cloud with a single command.
11
Without Docker, I would have to go into my terminal, make sure I have the right Python dependencies installed, and then run the app in the background every time I want to use it.
12
And on top of that, deployment to the cloud would be a lot more complex, and also more expensive.
13
First I want to talk about the app itself.
14
The reason I built this app in Python, and not my typical choice of JavaScript, is that there's a python package called removeBG,
15
which is based on the U2net model to magically remove the background with AI.
16
Oh man, I just realized I said the A word again.
17
I guess we have to reset the counter, but really this video has nothing to do with AI.
18
The model itself is heavily abstracted, to the point where all we do is open an image with Pillow, call the remove function from this library, which returns a new image with the background removed.
19
It's an extremely practical use case for image models, but I don't want to use it from the terminal.
20
I want to be able to drag and drop images directly from my browser into it, so I can then drag the result directly back into my Adobe Premiere timeline.
21
To do that, I built a little app with Flask, which creates a single HTTP route that handles both git and post methods.
22
Git displays the initial webpage, then when we drag an image into that webpage, it makes a post request, which calls that remove background function.
23
Now the website itself is rendered in this index.html file, which uses nothing but plain JavaScript and CSS.
24
There's an HTML form with a file input, then when that form is submitted, it makes a post request to the root URL.
25
I also wrote a little bit of JavaScript here that will automatically submit the form when a file is dropped onto it, just to make the process even more efficient.
26
That's the entire app, and now I can run it from the terminal with the Python command.
27
But now here's where Docker comes in.
28
I want to be able to use this code on multiple computers, and I also want to deploy it to the web
29
so I could even use it from my phone or some other device.
30
And I want everyone in the world to have the opportunity to use my awesome invention.
31
First, you'll need to have Docker installed.
32
I'm doing that through Docker Desktop, but in the past I've used tools like Podman, which is developed by Red Hat and is also a good option.
33
But now we need to go into our code and create a Docker file.
34
The Docker file itself is very simple.
35
It starts with the official Python base image, creates a working directory for the app, installs the dependencies, copies the code, exposes a port, and then runs the app.
36
The only unusual thing I'm doing here is taking the actual AI model weights and copying them into the Docker image.
37
The weights are about 175 megabytes, and doing this prevents the actual Python package from downloading asynchronously, which will slow things down in general.
38
Now let's build the image and make sure to give it a tag.
39
That'll take a minute, then if we go into Docker Desktop, we should see it here in the images panel.
40
To actually run the image as a container, we simply hit the play button, and make sure to map the port to something we can use on localhost.
41
And now the app is always ready to go in the background with Docker.
42
Pretty cool, and that's how I use this tool 90% of the time, but I also want to show you how to deploy it to the web.
43
There's a bunch of different options for deploying containers to the cloud, and there's also some free options if you're cheap like me.
44
The most well-known option is Elastic Container Engine on AWS with a related service called Fargate
45
that can deploy your container in a serverless way, which means it will scale down to zero when it's not in use
46
and then scale back up once the requests start coming in.
47
You've also got services like the app platform on DigitalOcean, which starts at $0 a month, but my go-to for deploying random utilities like this is Google Cloud Run.
48
To deploy something that's dockerized, though, you first need to get your image on a registry.
49
Every cloud has one built in, and on Google, it's called Artifact Registry.
50
What you do is create a repository for your images that'll store them in a specific region, and then you can copy this link up here, which can be used as a tag on your images,
51
so it knows where to upload them.
52
Let's go into the terminal and use the docker tag command to tag our existing image with this namespace.
53
Once that's done, we can use the docker push command to upload it to Google Cloud.
54
Now, one caveat is that of course you need a Google Cloud account, and you'll also need the gcloud CLI tool installed on your system.
55
But once that's done, you should then be able to see the image in Google Cloud.
56
One nice thing about this is that if you want to use this image on a different machine, you can simply pull it from this repo.
57
But now let's head over to Cloud Run and deploy it to the internet.
58
Create a new service, then the first thing you'll do is select that container image.
59
Now from here we have a bunch of configuration options, but if you want to make this a public web service, the most important one is to allow unauthenticated invocations.
60
That means anybody can access it from a public API or URL.
61
The next option is CPU allocation.
62
One problem with serverless deployments is that when the app is not being used, it scales down to zero, which is great because it means you're not paying for anything, but the tradeoff is a cold start,
63
which means it takes like four or five seconds for the thing to boot up when the next request comes in.
64
In my case, that's not a problem, but if you want to eliminate cold starts, you can make sure that the CPU is always allocated.
65
It's just going to cost more because you'll always be burning through these free CPU seconds every month.
66
Now from there, let's go down to the container options, and one thing we'll also want to change here is the allocated memory for the container.
67
It takes a lot of memory to run the AI model, so let's bump this up to two gigabytes.
68
One other thing I want to do is also decrease the amount of auto-scaling this thing can do.
69
Instead of 100 maximum instances, I'm only going to allow three.
70
We just don't need to be prepared to scale for this type of app, but it's nice to have that option if you're building something viral.
71
Let's go ahead and deploy it, and a few minutes later, we should have a URL where we can actually access our Python app on the web.
72
Pretty awesome, and one huge benefit of having this all dockerized is that our code is portable, so if we want to get off Cloud Run, we could take that to any other cloud service and deploy it there just as easily.
73
And that's basically all there is to it.
74
There's a ton of other stuff we could talk about when it comes to Docker and Cloud run, but let me know what you want to see next in the comments.
75
I do have one update for Fireship Pro members.
76
I'm currently finishing up a new Stripe course that's designed specifically for people building software as a service products.
77
More details to come on that soon.
78
Thanks for watching, and I will see you in the next one.

App downloaden

Alles wat je nodig hebt om vloeiend te spreken

AI UitspraakScoor elke zin
IPA OefeningBeheers elk geluid
WoordenschatBouw je woordenschat op
WoordenspelLeren terwijl je speelt

Zelfde Kanaal

FOR YOU

Aanbevolen Video

Woordenschat en spreektips bij deze les

Deze spreekles op niveau C1 is gebaseerd op de video “How I deploy serverless containers for free”. Deze woorden komen het vaakst terug: image, docker, app, cloud, background. Deze video bevat 78 zinnen en 1619 woorden om na te spreken. Het gesproken deel duurt 6:32. De spreker praat snel, ongeveer 248 woorden per minuut, dus reken op verbonden en ingeslikte klanken. 82% van de woorden hoort bij de 3.000 meest gebruikte Engelse woorden; de rest kun je beter vooraf bekijken.

Belangrijke woorden in deze video

De 15 moeilijkste woorden uit de video, met uitspraak en betekenis:

WoordUitspraakBetekenis
deploy werkwoord/dɪˈplɔɪ/uitrollen
container zelfstandig naamwoord/kənˈteɪ.nəɹ/bak
upload werkwoord/ˈʌpˌloʊd/uploaden
sponsor zelfstandig naamwoord/ˈspɒn.səː/sponsor
dependency zelfstandig naamwoord/dɪˈpɛndənsi/afhankelijkheid
caveat zelfstandig naamwoord/ˈkæviɑt/waarschuwing
gigabyte zelfstandig naamwoord/ˈɡɪɡəbaɪt/gigabyte
inefficiency zelfstandig naamwoordinefficiëntie
namespace zelfstandig naamwoord/ˈneɪmspeɪs/naamruimte
repository zelfstandig naamwoord/ɹɪˈpɒz.ɪ.t(ə.)ɹɪ/opslagplaats, depot
allocation zelfstandig naamwoord/ˌæl.əˈkeɪ.ʃən/allocatie, toewijzing
render werkwoord/ˈɹɛn.dɚ/veroorzaken
reset werkwoord/ɹiːˈsɛt/herinitialiseren, terugstellen
unacceptable bijvoeglijk naamwoord/ˌʌn.ækˈsɛp.tə.bl̩/onaanvaardbaar, onacceptabel
luckily bijwoord/ˈlʌk.ɪ.li/gelukkig

Phrasal verbs die je zult horen

WoordBetekenis
back up werkwoordteruggaan
check out werkwoordonderzoeken
get off werkwoordvan ... afgaan

Grammatica in deze video

De structuren die de spreker het meest gebruikt, met de exacte woorden uit de video:

StructuurIn de video
Lijdende vorm be + voltooid deelwoord — het gaat om wat er gebeurt, niet om wie het doetwas sponsored · is not sponsored · is based
Betrekkelijke bijzinnen who / which + zin — extra informatie over een persoon of dingremover, which is · Podman, which is · way, which means

Uitspraak om op te letten

De spreker gebruikt 22 samentrekkingen en verkorte vormen, zoals I'm, you'll, you're. Spreek ze kort uit, zoals je ze hoort.

  • De klanken “sh” en “zh”: inefficient /ˌɪn.ɪˈfɪʃ.ənt/, invocation /ˌɪn.voʊˈkeɪ.ʃən/, allocation /ˌæl.əˈkeɪ.ʃən/, configuration /kənˌfɪɡ.əˈɹeɪ̯.ʃən/, invention /ɪnˈvɛnʃən/
  • Lange woorden — let op de klemtoon: dependency /dɪˈpɛndənsi/, inefficient /ˌɪn.ɪˈfɪʃ.ənt/, invocation /ˌɪn.voʊˈkeɪ.ʃən/, repository /ɹɪˈpɒz.ɪ.t(ə.)ɹɪ/, allocation /ˌæl.əˈkeɪ.ʃən/

Klanken die Nederlandstaligen lastig vinden:

  • Stemhebbende eindmedeklinker — /b/, /d/, /g/, /z/, /v/ niet verscherpen: upload /ˈʌpˌloʊd/, expose /ɪkˈspoʊz/
  • /æ/ — opener dan de Nederlandse “e”: allocate /ˈæl.ə.keɪt/, caveat /ˈkæviɑt/, magically /ˈmæd͡ʒ.ɪ.kli/, allocation /ˌæl.əˈkeɪ.ʃən/, unacceptable /ˌʌn.ækˈsɛp.tə.bl̩/
  • /g/ — een harde plofklank, geen Nederlandse “g”: gigabyte /ˈɡɪɡəbaɪt/, megabyte /ˈmɛɡəˌbaɪt/, configuration /kənˌfɪɡ.əˈɹeɪ̯.ʃən/

Zo oefen je met deze video

  1. Luister de hele video één keer zonder te spreken en noteer de woorden die je niet kent.
  2. Begin op 0,75× snelheid, spreek zin voor zin na en ga terug naar normale snelheid zodra het makkelijk gaat.
  3. Neem jezelf op en vergelijk met het origineel; let daarbij op woorden als deploy, container, upload.

Wat is de Shadowing-techniek?

Shadowing is een wetenschappelijk onderbouwde taalleermethode die oorspronkelijk is ontwikkeld voor professionele tolkentraining en gepopulariseerd door polyglot Dr. Alexander Arguelles. De methode is eenvoudig maar krachtig: je luistert naar native Engelse audio en herhaalt het onmiddellijk hardop — als een schaduw die de spreker volgt met slechts 1–2 seconden vertraging. In tegenstelling tot passief luisteren of grammaticadrills, dwingt shadowing je hersenen en mondspieren om echte spraakpatronen tegelijkertijd te verwerken en te reproduceren. Onderzoek toont aan dat het de uitspraaknauwkeurigheid, intonatie, ritme, verbonden spraak, luisterbegrip en spreekvaardigheid aanzienlijk verbetert — waardoor het een van de meest effectieve methoden is voor IELTS Speaking-voorbereiding en echte Engelse communicatie.

Shadowing-techniek: lees de volledige stap-voor-stap-gids →