File size: 904 Bytes
5eca0b2
 
 
 
 
 
 
 
 
0130234
5eca0b2
16bb651
 
0130234
 
 
 
16bb651
 
 
 
 
 
 
 
 
 
5eca0b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import sys, signal, base64, re, io, json, time
from io import BytesIO
from pathlib import Path
from typing import Dict
import subprocess
import requests
import gradio as gr
from PIL import Image
import os 

from app import MAPPER, save_run

api_key = os.getenv("JINA_TOKEN")

MAPPER.model.set_api_key(api_key)

inputs = [
    ("A person riding a bicycle near the ocean", "https://cdn.duvine.com/wp-content/uploads/2016/04/17095703/Slides_mallorca_FOR-WEB.jpg"),
    ("Computing jobs in the US", "https://www.ayresassociates.com/wp-content/uploads/2019/02/Career-Expo-Pie-Chart-Crop.jpg"),
    ("Graph of profession choices in bangladesh", "https://notepadacademy.com/wp-content/uploads/2023/08/image.png")
]

for input in inputs:
    img_proc, _, _  = MAPPER.process_image(input[1])
    toks, maps = MAPPER.get_token_similarity_maps(input[0], img_proc)
    save_run(input[0], input[1], img_proc, maps)