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
Submitting Veo 3 video task to Vertex AI | |
Endpoint: https://us-central1-aiplatform.googleapis.com/v1/projects/story-board-467506/locations/us-central1/publishers/google/models/veo-3.0-fast-generate-001:predict | |
Request payload: { | |
"instances": [ | |
{ | |
"image": "https://36fa157391d7.ngrok-free.app/assets/storyboard/scene_0_image_0_imagen-4.png", | |
"prompt": "A sleeping hero, Zero, is awakened by Ciel in a desolate future, his memories fragmented but his resolve to fight clear." | |
} | |
], | |
"parameters": { |
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
/** | |
* Simplified Phaser.js game template | |
* References modular components instead of embedding entire code | |
*/ | |
const PHASER_TEMPLATE_MINIMAL = ` | |
// Import game framework modules (pre-loaded in game environment) | |
const { AUDIO_ASSETS } = window.GameModules.AudioAssets; | |
const { AudioManager } = window.GameModules.AudioManager; | |
const { CanvasEffectsManager } = window.GameModules.CanvasEffects; |
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 numpy as np | |
def find_consecutive_non_zeros(arr): | |
non_zero_indices = np.nonzero(arr)[0] | |
if len(non_zero_indices) < 2: | |
return [] | |
results = [] | |
i = 0 |
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 generate_image(unet, autoencoder, scheduler, condition, num_inference_steps=50, guidance_scale=7.5): | |
# Set models to evaluation mode | |
unet.eval() | |
autoencoder.eval() | |
# Prepare the condition | |
if condition.dim() == 1: | |
condition = condition.unsqueeze(0) # Add batch dimension | |
if condition.dim() == 2: | |
condition = condition.unsqueeze(1) # Add sequence length dimension |
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 pandas as pd | |
import os | |
import numpy as np | |
from glob import glob | |
from sklearn.preprocessing import OneHotEncoder | |
# Path to TSV file and image directory | |
tsv_path = "participants.tsv" | |
image_dir = "data" |
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
''' | |
1. Define a Kernel: | |
Design a kernel function (or a set of coefficients) that will “spread” | |
each element of your 14×1 sequence over a larger spatial extent. | |
For example, you might choose an exponentially decaying or Gaussian kernel | |
that determines how much influence each element has over nearby locations. | |
2. Construct a Toeplitz Matrix: | |
Build a Toeplitz matrix where the first column is your (possibly zero‑padded) | |
14‑element vector and the first row is defined by your kernel. This yields |
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 main(): | |
# Read input from input.txt | |
with open("input.txt", "r") as fin: | |
# First line: highway length K and maximum allowed distance L | |
line = fin.readline().strip() | |
if not line: | |
return | |
K, L = map(int, line.split()) | |
# Second line: number of off-ramps (not used directly) |
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 main(): | |
# Read input | |
with open("input.txt", "r") as fin: | |
# First line: highway length K and maximum allowed distance L | |
first_line = fin.readline().strip() | |
if not first_line: | |
return | |
K, L = map(int, first_line.split()) | |
# Second line: number of off-ramps (we read it but won't rely on it) |
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 bisect | |
def read_input() -> tuple: | |
with open("input.txt", "r") as fin: | |
# First line: highway length K and maximum allowed distance L | |
first_line = fin.readline().strip() | |
if not first_line: | |
return | |
K, L = map(int, first_line.split()) |
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
class Solution: | |
def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]: | |
""" | |
Removes all nodes that have duplicate numbers, leaving only distinct numbers from the original list. | |
:param head: The head of the sorted linked list. | |
:return: The head of the list after removing duplicates. | |
""" | |
# Initialize a dummy node to handle edge cases gracefully | |
dummy = ListNode(0) |
NewerOlder