from lmdeploy import pipeline, GenerationConfig, TurbomindEngineConfig from lmdeploy.vl import load_image import spaces import gradio as gr from PIL import Image import numpy as np @spaces.GPU def create_captions_llava_llama3_docci(image): pipe = pipeline('Lin-Chen/open-llava-next-llama3-8b') gen_config = GenerationConfig(repetition_penalty=1.10) image = Image.fromarray(np.uint8(image)).convert('RGB') response = pipe(('As an AI image annotation expert, please provide accurate annotations for images to enhance the CLIP model's understanding of the content.If the image has a distinct style or filter, it also needs to be labeled. Your label should be accurate, non repetitive. These labels will be used for image reconstruction, so the closer the similarity to the original image, the better the label quality.Special tags will receive a reward of $10 per image.', image), gen_config=gen_config) return response.text css = """ #mkd { height: 500px; overflow: auto; border: 1px solid #ccc; } """ with gr.Blocks(css=css) as demo: gr.HTML("