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
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() |
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
// 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': |
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
{ | |
"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++) { |