This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import modal | |
# how to run: | |
# modal run modal_deploy.py | |
# modal run --detach modal_deploy.py | |
image = ( | |
modal.Image | |
.debian_slim() | |
.pip_install_from_pyproject("pyproject.toml") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flip_frame(frame_data, flip=True): | |
""" | |
Create a flipped version of a frame by horizontally flipping camera images | |
and inverting the first dimension of action and state tensors. | |
Args: | |
frame_data: Dict containing frame data | |
flip: Boolean indicating whether to actually flip the frame (default: True) | |
If False, only format standardization is performed | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import modal | |
from diffusers.utils import load_image | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from PIL import Image | |
from PIL import ImageDraw | |
import cv2 | |
from tqdm.notebook import tqdm | |
from typing import List, Optional, Dict, Union |