Views
No views yet
1from transformers import pipeline
2from PIL import Image
3import requests
4
5pipe = pipeline("image-to-text", model="waleko/TikZ-llava-1.5-7b")
6
7url = "https://waleko.github.io/data/image.jpg"
8image = Image.open(requests.get(url, stream=True).raw)
9prompt = "Assistant helps to write down the TikZ code for the user's image. USER: <image>\nWrite down the TikZ code to draw the diagram shown in the image. ASSISTANT: "
10
11print(pipe(image, prompt=prompt)[0]['generated_text'])