-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create websocket tutorial #180
base: main
Are you sure you want to change the base?
Conversation
Create tutorial for websocket streaming in RunPod.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to run the formatter on this.
yarn format
@@ -0,0 +1,328 @@ | |||
# Introduction to Websocket Streaming with RunPod Serverless |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to create header information like this:
---
title: Your title
description: "Some description"
sidebar_position: 8
---
@@ -0,0 +1,328 @@ | |||
# Introduction to Websocket Streaming with RunPod Serverless | |||
|
|||
Createa your development environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Createa your development environment. | |
Create your development environment. | |
``` mkdir runpod-base64-stream | ||
cd runpod-base64-stream | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install runpod Pillow | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` mkdir runpod-base64-stream | |
cd runpod-base64-stream | |
python -m venv venv | |
source venv/bin/activate | |
pip install runpod Pillow | |
``` | |
```sh | |
mkdir runpod-base64-stream | |
cd runpod-base64-stream | |
python -m venv venv | |
source venv/bin/activate | |
pip install runpod Pillow |
Create a new file called handler.py. Remember that the handler loop is how code gets executed when a worker is active. In this example, this handler will simulate image processing. Since this tutorial is to demonstrate the serverless environment more than process images, we will have it just create a static, blank image as the payload. | ||
```import runpod | ||
import base64 | ||
import io | ||
from PIL import Image | ||
import time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a new file called handler.py. Remember that the handler loop is how code gets executed when a worker is active. In this example, this handler will simulate image processing. Since this tutorial is to demonstrate the serverless environment more than process images, we will have it just create a static, blank image as the payload. | |
```import runpod | |
import base64 | |
import io | |
from PIL import Image | |
import time | |
Create a new file called handler.py. Remember that the handler loop is how code gets executed when a worker is active. In this example, this handler will simulate image processing. Since this tutorial is to demonstrate the serverless environment more than process images, we will have it just create a static, blank image as the payload. | |
```sh | |
import runpod | |
import base64 | |
import io | |
from PIL import Image | |
import time |
```docker build --platform linux/amd64 -t your-dockerhub-username/runpod-base64-stream:latest . | ||
docker push your-dockerhub-username/runpod-base64-stream:latest | ||
``` | ||
Here, we'll provide an example of how to interact with the endpoint in code. You'll need to provide your RunPod API key and Endpoint ID in the variables up top. Let's call this test_endpoint.py. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we'll provide an example of how to interact with the endpoint in code. You'll need to provide your RunPod API key and Endpoint ID in the variables up top. Let's call this test_endpoint.py. | |
Here, we'll provide an example of how to interact with the endpoint in code. You'll need to provide your RunPod API key and Endpoint ID in the variables up top. Let's call this `test_endpoint.py`. |
Add code blocks.
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create tutorial for websocket streaming in RunPod serverless.