Skip to content

Instantly share code, notes, and snippets.

View webeng's full-sized avatar

Joan webeng

  • SpecifiedBy
  • Edinburgh
View GitHub Profile
from transformers import FuyuForCausalLM, AutoTokenizer, FuyuProcessor, FuyuImageProcessor
from PIL import Image
import torch
import argparse
parser = argparse.ArgumentParser()
# parser.add_argument("--image_path", type=str, default="amazon_screenshot.png")
parser.add_argument("--text_prompt", type=str, default="Generate a coco-style caption.\n")
args = parser.parse_args()
@webeng
webeng / url_shortener
Last active December 1, 2015 11:15
This script converts an integer to a string using a defined charset. It also converts the string back to an integer. This is useful as a url shortener.
// Get the charset to be used, the longer the charset the shortener the output will be
function charset($length = 36) {
switch ($length) {
case '36':
$charset = '0123456789abcdefghijklmnopqrstuvwxyz';
break;
case '64':
{
"size": 20,
"from": 0,
"query": {
"function_score": {
"script_score": {
"script": "count = ids.size();
id = - ids.indexOf(doc['id'].value);
for ( i = 0; i < count; i++) {